Problem with Domainfunction

TURabbIT

Registered User.
Local time
Today, 17:37
Joined
Sep 9, 2014
Messages
10
I intendet to get a Value from a Query for a textbox, so I tried to use the Domainfunction DFirst.

Code:
=DFirst("[SAPANLAGE]";"[Query_Anlage_42]")
but now the box just shows #error and blinks like crazy. :eek:

I have no idea whats the problem with that, anybody an idea? :confused:
 
What value are you trying to get?
Where did you place this code?
Tell us the field name and the name of the table.
 
Depend on where you use it, then change the ";" to ","
Code:
=DFirst("[SAPANLAGE]"[B][COLOR=Red];[/COLOR][/B]"[Query_Anlage_42]")
 
I try to get any value from the query
[Query_Anlage_42] at [Query_Anlage_42]![SAPANLAGE]
and insert this value in a textbox in a subform.

I tried the code in the properties in the field for the element content.

The help told me to use this syntax with ';' and without this the field just shows "#Name" and access tells me there is an syntax error in the line
 
You should get an "invalid syntax" error with one of them.

Who said you should use the semi-colon? Do you have any other function that works with the semi-colon?
 
The ';' is correct. Pretty sure. :rolleyes:
Several How-Tos from the web and the access help for DFirst told me to use the semicolon.
Any integrated function (like "if" and so on) uses semicolon to seperate the syntax parts of the command.

Without semicolon I get syntax error.
 
Ok.

Not that it should make any difference, but have you tried DLookup()?
Where are you using this function? In a textbox on a report or a form?
 
The textbox is in a subform and the code (tries to) refers to a query.

The code is in the content field for the attributes of this textbox
 
Are you really the query return a field name = [SAPANLAGE], (open/run the query and check it)?
 
Tried it with DLookup("SAPANLAGE"; "[Query_Anlage_42]")

So somehow it works now :D

THANK YOU!
 
I learned while working with access / microsoft:
Don't try to understand why it works as long as it works.
Sometimes there are such weird connections that cause trouble, i stopped asking.
 

Users who are viewing this thread

Back
Top Bottom