M MvP14 Registered User. Local time Today, 22:18 Joined Apr 15, 2003 Messages 66 Apr 17, 2003 #1 I can't find what is wrong in the following code: DoCmd.RunSQL "UPDATE Table1" & _ "SET Table1.Checkbox1 = False" & _ "WHERE Table1.Checkbox1 = True;" Can anyone help me out? Thank you.
I can't find what is wrong in the following code: DoCmd.RunSQL "UPDATE Table1" & _ "SET Table1.Checkbox1 = False" & _ "WHERE Table1.Checkbox1 = True;" Can anyone help me out? Thank you.
Mile-O Back once again... Local time Today, 20:18 Joined Dec 10, 2002 Messages 11,305 Apr 17, 2003 #2 Strange title..easy one! How do you know it's easy? At first glance I'd say it's because you are lacking spaces in your SQL statement. you are building an SQL statement that read like this: "UPDATE Table1SET Table1.Checkbox1 = FalseWHERE Table1.Checkbox1 = True;" As you can see, the areas in bold are being concatenated in the statement you have built. Try this: DoCmd.RunSQL "UPDATE Table1 " & _ "SET Table1.Checkbox1 = False " & _ "WHERE Table1.Checkbox1 = True;"
Strange title..easy one! How do you know it's easy? At first glance I'd say it's because you are lacking spaces in your SQL statement. you are building an SQL statement that read like this: "UPDATE Table1SET Table1.Checkbox1 = FalseWHERE Table1.Checkbox1 = True;" As you can see, the areas in bold are being concatenated in the statement you have built. Try this: DoCmd.RunSQL "UPDATE Table1 " & _ "SET Table1.Checkbox1 = False " & _ "WHERE Table1.Checkbox1 = True;"
M MvP14 Registered User. Local time Today, 22:18 Joined Apr 15, 2003 Messages 66 Apr 17, 2003 #3 That did it for me. Thank you. When I run the command, I get a message box now. Is there a way I can avoid that?
That did it for me. Thank you. When I run the command, I get a message box now. Is there a way I can avoid that?
Mile-O Back once again... Local time Today, 20:18 Joined Dec 10, 2002 Messages 11,305 Apr 17, 2003 #4 Change your code to this: Code: With DoCmd .SetWarnings False .RunSQL "UPDATE Table1 " & _ "SET Table1.Checkbox1 = False " & _ "WHERE Table1.Checkbox1 = True;" .SetWarnings True End With
Change your code to this: Code: With DoCmd .SetWarnings False .RunSQL "UPDATE Table1 " & _ "SET Table1.Checkbox1 = False " & _ "WHERE Table1.Checkbox1 = True;" .SetWarnings True End With