Solved

control source and dlookup ?

Posted on 1998-12-30
3
484 Views
Last Modified: 2008-02-20
I have a field which is has a dlookup. This is in the control source. When that data is displayed, I also want it to go into the appropriate field in the table. If the dlookup is in the control source, how do I fix this?
0
Comment
Question by:darcam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Expert Comment

by:tcurtin
ID: 1972301
why do you want it to do a dlookup  and use the table if you are returning the value in either?
0
 
LVL 2

Accepted Solution

by:
Belz earned 50 total points
ID: 1972302
Remove the DLookup from the control source.  Attach the control source to the field you want data stored in.  Inside a code event add the DLookup code and store it into the field on the form.  I'm not sure what you are trying to do and when, so I can't help you much on the event to place the code.  My normal events for items like this are OnCurrent, AfterUpdate, and LostFocus.
0
 
LVL 12

Expert Comment

by:Trygve
ID: 1972303
If you want to save the lookup (could be that the lookup values change by time and you want to keep track of the history) then you should use Belz' approach.

In the AfterUpdate of the controls that you use as part of the criteria for you dlookups insert something like this


me![The field that should get the value] = dlookup... ' Your dlookup expression from the form. Then set the dlookup fields controlsource to the field you want to store the information into.

You could also use the OnCurrent event for the form, but then the fields will be set as you move from one record to the next and this will slow down your application.


If the information that you look up does not change or you want to show the updated info at all times then you should not include the fields in your table, but simply have your dlookups on the form, and link the tables that you do lookups from into any recordsource that you use for reports etc.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

634 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question