fearmichaele
Registered User.
- Local time
- Today, 16:37
- Joined
- Jan 14, 2014
- Messages
- 34
I have a front end Access Form that is linked to a SQL Table. one the form when the user presses a button i want to ensure that the field named IncompleteDoc is not null but has a 1 in it. In SQL i would use the following query statement to accomplish this.
update [MMDB].[Intake].[TblIntakePatient] set [IncompleteDoc]=1 where IncompleteDoc is null
i want to do this in VBA because if that field is NULL then none of the users can update or delete any records. I need the value of 1 to be placed in that field to signify TRUE.
in my VBA project i have placed the following line
I am getting
VBA Error
3144
Syntax error in UPDATE statement.
i have tried several iterations of this code.
even in my WHERE statement i have [] around the field name and still get the same error.
I am using Access 2016 as the front end and i am using SQL Server 2016 to create my tables. i have looked at several syntax example on the web and even followed Microsoft examples
when i try to put in the &;_ VBA doesnt like that and produces a compile error
I have tried trial and error and now I am asking you, the experts, what the heck am i doing wrong?
Thank you in advance for your help.
update [MMDB].[Intake].[TblIntakePatient] set [IncompleteDoc]=1 where IncompleteDoc is null
i want to do this in VBA because if that field is NULL then none of the users can update or delete any records. I need the value of 1 to be placed in that field to signify TRUE.
in my VBA project i have placed the following line
DoCmd.RunSQL "UPDATE [MMDB].[Intake].[TblIntakePatient] SET [IncompleteDoc]= 1 WHERE IncompleteDoc is Null"
I am getting
VBA Error
3144
Syntax error in UPDATE statement.
i have tried several iterations of this code.
DoCmd.RunSQL ("UPDATE [MMDB].[Intake].[TblIntakePatient] SET [IncompleteDoc]= 1 WHERE IncompleteDoc is Null")
DoCmd.RunSQL "UPDATE [MMDB].[Intake].[TblIntakePatient] SET [IncompleteDoc]= 1 WHERE IncompleteDoc = Null"
DoCmd.RunSQL ("UPDATE [MMDB].[Intake].[TblIntakePatient] SET [IncompleteDoc]= 1 WHERE IncompleteDoc =Null")
even in my WHERE statement i have [] around the field name and still get the same error.
I am using Access 2016 as the front end and i am using SQL Server 2016 to create my tables. i have looked at several syntax example on the web and even followed Microsoft examples
SQL = "UPDATE Employees " &; _
"SET Employees.Title = 'Regional Sales Manager' " &; _
"WHERE Employees.Title = 'Sales Manager'"
DoCmd.RunSQL SQL
when i try to put in the &;_ VBA doesnt like that and produces a compile error
I have tried trial and error and now I am asking you, the experts, what the heck am i doing wrong?
Thank you in advance for your help.