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

Dlookup problems 1

Status
Not open for further replies.

rossten4744

IS-IT--Management
Sep 1, 2007
2
US
After looking at several postings on dlookup issues I am still stumped. I am working on a "Employee Detail" form. I have a field that is a combo box and contains the pay periods called [PPID]. My goal is that after selecting a pay period the start date is entered in [PPStart] field.

The PPID and PPStart live in table [tblPPStartEnd]. I am almost positive that the problem lies in my condition, but obviously I don't understand it enough to solve it.

My expression is in the form Dlookup(expression,where, Condition) =DLookUp("[tblPPStartEnd]![PPStart]","[tblPPStartEnd]"," [PPID]= & [tblPPStartEnd]![PPID] ")and is located in the control source of the PPStart field. An #Error is returned to the PPStart field.
Please Help.
 
Have you tried...

=DLookUp("[tblPPStartEnd]![PPStart]","[tblPPStartEnd]"," [PPID]= '" & [tblPPStartEnd]![PPID] & "'")

Ian Mayor (UK)
Program Error
Always make your words sweet and nice. Because you never know when you may have to eat them.
 
How are ya rossten4744 . . .

If you include the [blue]PPStart[/blue] field in the RowSource of the combobox, you won't need to perform DLookup. The [blue]AfterUpDate[/blue] event of the combobox would simply be:
Code:
[blue]   Me!PPStart = Me!ComboboxName.Column(1)[/blue]
You may have to change the column index to get the correct field (column index starts at zero1).

Also, you need to remove the code from the [blue]Control Source[/blue] of PPStart . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 

How about...
If PPID is numeric:
Code:
=DLookUp("PPStart", "tblPPStartEnd", "PPID = " & [i][COLOR=blue]ComboBoxName[/color][/i])

If the PPID is NOT numeric:
Code:
=DLookUp("PPStart", "tblPPStartEnd", "PPID = [COLOR=red][b]'[/b][/color]" & [i][COLOR=blue]ComboBoxName[/color][/i][COLOR=red][b] & " ' "[/b][/color])


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top