Solved

Dlookup Crashing

Posted on 2011-09-27
7
262 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

747 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

13 Experts available now in Live!

Get 1:1 Help Now