keek2a4
03-12-2008, 09:46 AM
Private Sub Command0_Click()
Dim db As Database
Dim insTbl As String
Set db = CurrentDb
CurrentDb.Execute "UPDATE tblStudent " & _
"SET tblStudent.deleted = 1;"
End Sub
I have the following code above that updates the field named "deleted" to 1 when the button is clicked. I need to include a "IF Statement" that checks the if the "flag" field in the school table is equal to 1, but I do not know the correct syntax for the IF statement. I am trying to achieve something like this:
Private Sub Command0_Click()
Dim db As Database
Dim insTbl As String
Set db = CurrentDb
If tblSchool.flag = 1 then ' how can I write the IF statement syntax in vba
CurrentDb.Execute "UPDATE tblStudent " & _
"SET tblStudent.deleted = 1;"
End IF
End Sub
Thanks
Dim db As Database
Dim insTbl As String
Set db = CurrentDb
CurrentDb.Execute "UPDATE tblStudent " & _
"SET tblStudent.deleted = 1;"
End Sub
I have the following code above that updates the field named "deleted" to 1 when the button is clicked. I need to include a "IF Statement" that checks the if the "flag" field in the school table is equal to 1, but I do not know the correct syntax for the IF statement. I am trying to achieve something like this:
Private Sub Command0_Click()
Dim db As Database
Dim insTbl As String
Set db = CurrentDb
If tblSchool.flag = 1 then ' how can I write the IF statement syntax in vba
CurrentDb.Execute "UPDATE tblStudent " & _
"SET tblStudent.deleted = 1;"
End IF
End Sub
Thanks