Solved

Dlookup Crashing

Posted on 2011-09-27
7
263 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:Patrick O'Dea
  • 5
  • 2
7 Comments
 
LVL 75
ID: 36713027
I don't seem to get an error. How exactly can I reproduce the issue?

mx
0
 
LVL 75
ID: 36713066
Here you go:

Me.Price1 = DLookup("[CostPrice]", "tblSPareParts", "[PartCode] = " & Chr(34) & Me.Part1 & Chr(34))
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
ID: 36713069
Private Sub Part1_BeforeUpdate(Cancel As Integer)

If Len(Me.Part1 & "") > 0 Then
Me.Price1 = DLookup("[CostPrice]", "tblSPareParts", "[PartCode] = " & Chr(34) & Me.Part1 & Chr(34))
Else
Me.Price1 = 0
End If

End Sub
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:Patrick O'Dea
ID: 36713099
Just run frmDetail and then click on the dropdown that is yellow !

Gives error 2471


Is this not happening with you??
0
 
LVL 75
ID: 36713112
Fixed ... see post above...

mx
0
 

Author Closing Comment

by:Patrick O'Dea
ID: 36713142
Perfect ! Thanks again!
0
 
LVL 75
ID: 36714097
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
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now