Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Dlookup Crashing

Posted on 2011-09-27
7
Medium Priority
?
272 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 - Microsoft MVP, Access and Data Platform) earned 2000 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

971 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