dcount in ms access

mana

Registered User.
Local time
Yesterday, 18:43
Joined
Nov 4, 2014
Messages
265
hello

i have the following code with dcount

If DCount("Username", "[tbl_userinformation]", "[Username] = " & Me![Text146] & " AND [actualdate]=" & Me![Text148] & " ") > 0 Then

but i have the following error can you help me please? thank you

runtime erro 3075: syntax error in number in query expression '[username]=f15691b and [actualdate]=13.04.2015'

f15691b and 13.04.2015 are the values those i entered.
thank you
 
The text needs to be wrapped in single quotes and dates inside # tags. So try.
Code:
If DCount("*", "tbl_userinformation", "Username = '" & Me![Text146] & _
                                      "' AND [actualdate] = " & Format(Me![Text148],"\#mm\/dd\/yyyy\#")) > 0 Then
 
Hello

i also added the following code
can you help me please?
what should i do?
i have an errror
thank you very much

If DCount("*", "tbl_userinformation", "Username = '" & Me![Text146] & _
"' AND [actualdate] = " & Format(Me![Text148], "\#mm\/dd\/yyyy\#") AND "[Anwendung] = 'No')
 
You need to concatenate things properly. Try,
Code:
If DCount("*", "tbl_userinformation", "Anwendung = False AND " & _
                                      "Username = '" & Me![Text146] "' AND " & _
                                      "[actualdate] = " & Format(Me![Text148],"\#mm\/dd\/yyyy\#")) > 0 Then
 
and anwendung is a boolean type yes/no
 
thank you but it has syntax error
can you help me please?
i don't know where the problem is
 
is field Username in tbl_userinformation a lookup field? if so, it is probably expecting a number rather than text

also

AND "[Anwendung] = 'No')

should be

AND [Anwendung] = 0")
 
thank you
do you know how i can export the data from a table in ms access to a text file once a day automaticallly?
thank you for your help
 
research using the form timer event and DoCmd.OutputTo
 
hello

thank you very much
i changed something in this code but it has error now do you know what the problem is?

thank you

If DCount("*", "tbl_userinformation", "[05_Henrichpiramid] = False AND " & _
"Username = '" & Me![Text146] & _
"' AND [actualdate] = " & Format(Me![Text148], "\#mm\/dd\/yyyy\#")) > 0 Then
 
Hello

i have the following update and i have error
do you kknow where it is?
i have synttax error
i think it is in & "05-Henrichpiramid" & part
thank you


DoCmd.RunSQL (" update tbl_userinformation " & _
"SET [combination] = & "05-Henrichpiramid" & " & _
"where [Username]= Text146.value AND actualdate=Text148.value ;")
 

Users who are viewing this thread

Back
Top Bottom