0
votes

A small question but this is irritating me from 3 hours i tried to use the Dlookup Function in ms access.

I have two subforms in main form in and i tried to get some values from the 1st sub form to the second sub form This gave me a #error but i gave a correct syntax.

I just checked it with a small input and what ever i gave in the form whether it may be a small dlookup command also its giving me the same error.

Confused about whats happening in the forms and please look at the sample dllok up syntax i gave in my forms.

=DLookUp("Fertigungsmenge";"Porduction Table";"Fertigungsmenge=200000")

This small command is also giving me a #error i want to know the exact syntax we use for forms in ms access.

thanks in advance.

1
if you have the source table open in design it cannot retrieve data so it gives the error. Close all related tables and try again.DinoY

1 Answers

0
votes

Table names, Field names that have special characters - yes that includes Spaces; should be enclosed in square brackets. So try.

= DLookUp("Fertigungsmenge";"[Porduction Table]";"Fertigungsmenge = 200000")

Also, the DLookup will fail if there is no value found for the criteria. It will return a Null instead. So it would be best you wrap the DLookup with a Nz() function.

Finally, the separator normally is a comma (',') a very few countries/regions have the semi-colon (';') as the separator. So give that one final check.

PS: To refer Forms and SubForm controls refer to this matrix : http://access.mvps.org/access/forms/frm0031.htm