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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform DLookup Syntax

Status
Not open for further replies.
May 5, 2002
79
US
I have a form subform combination. I need to do a Dlookup to populate a field QuickenCode in the subform. I am executing the following in an after update event on the field ExpenseCodeID in the Subform. It fails on syntax. I inherited the table and form IDs with the spaces in the name (ugh). Any ideas?

Many thanks.


The code is:

Me.QuickenCode.Value = DLookup("[NonBillableQuicken]", "Expense Codes", "[ExpenseCodeID] = " _
& Forms![Time Cards]![Time Cards Expense Subform]!ExpenseCodeID)
 
Hi!

You say that both controls resice in the subform, perhaps:

[tt]Me!QuickenCode.Value = DLookup("[NonBillableQuicken]", "[Expense Codes]", "[ExpenseCodeID] = " _
& Me!ExpenseCodeID)[/tt]

i e just use the me keyword to refer to the control

HTH Roy-Vidar
 
You have of course also added the brackets too ([Expense Codes])?

Checked the spelling of the control names and, table names and field names.

Try debug.print Me!ExpenseCodeID, Debug.Print the whole Dlookup. Is the id text, then enclose it in text quelifiers:

[tt]..."[ExpenseCodeID] = '" _
& Me!ExpenseCodeID & "'")[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top