Link to home
Start Free TrialLog in
Avatar of Patrick O'Dea
Patrick O'DeaFlag for Ireland

asked on

Dlookup Crashing

Hi ,
See attached.
Click on frmDetail.
Then click on the yellow field.
This is a part code which should then find a "CostPrice" from tblSpareParts.

However, it gives and error when the part code is chosen.
I appreciate that the data strucures are not great.
However, could some one advise how I can stop my dlookup from crashing.
Keylight4.zip
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

I don't seem to get an error. How exactly can I reproduce the issue?

mx
Here you go:

Me.Price1 = DLookup("[CostPrice]", "tblSPareParts", "[PartCode] = " & Chr(34) & Me.Part1 & Chr(34))
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Patrick O'Dea

ASKER

Just run frmDetail and then click on the dropdown that is yellow !

Gives error 2471


Is this not happening with you??
Perfect ! Thanks again!
You are welcome.

Remember, Text criteria has to be surrounded with double quotes ( Chr(34) ) and Date criteria has to be enclosed with #'s

mx