n00b question (1 Viewer)

border20

Registered User.
Local time
Today, 06:50
Joined
Jan 8, 2003
Messages
92
...

I fund the following code on the net but didn't work... says the update expression is missing a parameter

Dim dbs As Database
Dim qdf As QueryDef

Set dbs = CurrentDb
dbs.Execute "UPDATE alarm" & "SET 'field name' = True " & "WHERE 'field name' = false"

dbs.Close

can anyone see something wrong ?
thx
 

sambo

Registered User.
Local time
Yesterday, 22:50
Joined
Aug 29, 2002
Messages
289
Create a string variable and put the Update query string into it. Then run the Sql using Docmd.Runsql
Also, don't make things so difficult. If you simply want all of the values to change to True, then change them all to True.


Code:
Dim sqlStr as String

sqlStr = "UPDATE TableName SET TableName.BooleanFieldName = True;"

DoCmd.RunSQL sqlStr
 

border20

Registered User.
Local time
Today, 06:50
Joined
Jan 8, 2003
Messages
92
If BooleanFieldName is in more than 1 word, do i use brackets ??
" or ' ?
 

sambo

Registered User.
Local time
Yesterday, 22:50
Joined
Aug 29, 2002
Messages
289
Two part answer:

1. Why did you name your field w/ two names???

2. Yes, use brackets (to answer your original question)
 

border20

Registered User.
Local time
Today, 06:50
Joined
Jan 8, 2003
Messages
92
I'm not the one who names the field... its a big project.. i just took it over
 

sambo

Registered User.
Local time
Yesterday, 22:50
Joined
Aug 29, 2002
Messages
289
Bummer deal..

Did the update query work?
 

Users who are viewing this thread

Top Bottom