Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text box sourced from table needs alternative query source

Status
Not open for further replies.

njwcad

Technical User
Oct 16, 2002
156
GB
Hello

Hope you can help again

I have a text box on a subform whose record source is from the underlying table. I would like to automatically input a value in the text box based on a query. I have tried to set the default value on the underlying table and in the text box property but it doesn't seem to work. I may be missing something obvious but is there any other way to achieve this

Thanks again in advance
Njwcad
 
Hi nj,

Heard of the DLookup function?
[tt]
textbox.value = DLookUp("[fieldname]", "tablename", "[EmployeeID] = 7")
[/tt]

Would place the 'fieldname' value into your textbox from 'tablename' where the EmployeeID = 7.

You would have to ensure that there was only ever one value returned.

ATB

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience. darrylles@yahoo.co.uk
 
Have you tried to set the default value of the textbox itself?

Pampers [afro]
Just let it go...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top