Ms Access Dlookup Not Working
Getting error that I can't figure out VBA: Duplicated code in another form is not working How to make DLookUP function works.. Mike Thursday, March 14, 2013 3:14 PM Reply | Quote 1 Sign in to vote Private Sub cboZipCheck_AfterUpdate() Me.txtCity = DLookup("City", "tblZipCodes", "Zipcode” = me.cboZipCheck) Me.txtCity = DLookup("State", "tblZipCodes", One table, one form. The only info that needs to be stored in the Record Source (using the control source) should be that customer code (I would think). http://www.access-programmers.co.uk/forums/showthread.php?t=204289
Web|-- Other Microsoft ProductsPC|-- Network Issues|-- Q & A - Hardware|-- Q & A - Software|-- Q & A - Other PC|-- Virus + Security DiscussionUtterAccess Odds and Ends|-- General Chat|-- Thanks for the effort in helping. I'm sure it's a syntax issue but I can't seem to get the DLookup to work while using the variable: loginID vba ms-access access-vba ms-access-2010 share|improve this question edited Mar 19
If you look at the posted example (I've indicated character positions) : Expand|Select|Wrap|Line Numbers 12345678 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456 CustomerName=dlookup("CustomerName","Customers","customerCode="'&CustomerCode)&"'" A single quote (') is treated as a comment indicator in VBA unless it Did the Gang of Four really thoroughly explore "Pattern Space"? People will make efforts to help you at your level if you make it clear what it is you can understand. What is the number of parameters for AIC if some coefficients are zero?
Then the code would simply be: Me!txtState = Me!cboZipCheck.Column(2) Me!txtCity = Me!cboZipCheck.Column(3) -- cu Karl ********* Access-FAQ (German/Italian): http://www.donkarl.com Edited by Karl DonaubauerMVP Thursday, March 14, 2013 3:57 PM line breaks I now get the following error though: "The expression After Update you entered as the event property setting produced the following error: Syntax error" As "Company" is text, I changed the If you look at the characters at positions #64 & #65, you'll notice the double-quote (") appears before the single-quote ('). http://stackoverflow.com/questions/22514876/dlookup-not-working-when-using-a-variable And there are no error messages or codes - just blank fields.
Hi Mike, "Zipcode = '28806'" works because the Zipcode field is defined as a Text field. No extraneous DLookups() required even. No, following your description this should work: DLookup("City", "tblZipCodes", "Zipcode='" & Me!cboZipCheck.Column(1) & "'") DLookup("State", "tblZipCodes", "Zipcode='" & Me!cboZipCheck.Column(1) & "'") Alternatively you could change the row source of cboZipCheck to Join Now For immediate help use Live now!
I could, but the problem is just now resolved. http://answers.microsoft.com/en-us/msoffice/forum/msoffice_access-mso_other/dlookup-not-working-in-access-subform/917965fc-a6c3-4de6-b31c-32283059fcab When you get the error message try typing 'Debug.print CustomerCode' in the 'Immediate Window'. (To open and close the Immediate Window press Ctrl-G.) For debugging this problem you can also try Thanks for your help as I appreciate it very much. In the form called Item Subform , I have a combo box that uses both fields from the table L-Property-ClassList (see below).
Thanks, Nick Attached Files Line Plan.mdb (864.0 KB, 142 views) Nevsky78 View Public Profile Find More Posts by Nevsky78