Control with Dlookup source not showing data

S

SAC

I have a forn with a textbox whose control source is dlookup...

When I open the form the control does not show any data. However, when I
click on the control the data is displayed.

Any ideas on how to make the data display when the form opens?

Thanks.
 
A

Allen Browne

If the DLookup() expression depends on other controls on the form, chances
are that those values are not present early enough.

Use ReCalc to force the calculated expressions to update.

Either that, or get the data for the expression from somewhere independent
of the form.
 
S

SAC

I'm not sure where to put the recalc. I put it in the on_current event as
me.recalc. I see the valuse briefly in the control then it goes blank.

Where can I put it so it'll work.

Thanks, Allen.
 
A

Allen Browne

Agreed: Form_Current's not really a good idea. Form_Open and Form_Load are
probably too early, and Form_Activate is not good either.

Perhaps you could use an unbound text box, and assign it a value in
Form_Current.
 
S

SAC

Excellent! I put the dlookup in the data source query. Works fine EXCEPT
the format.

The control on the form is formatted for Currency, but I'm getting several
decimal places. I changed the format for the column in the query and I'm
still getting the same result.

How can I fix this?

Thanks, again.
 
S

SAC

Never Nind. I got the formatting. I just used the format function in the
coloumn in the query and it works great.

Thanks for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Dlookup Where Clause 2
DLookup in Text box to show Currency (number field) 9
Nz in a DLookup control ? 12
DLookUp behavior 1
Bound a DLookUp Value 2
dlookup 2
What am I doing wrong: DLookUp 2
Trouble with DLookup 3

Top