Afrosheen said:
Thanks for the help.
Private Sub A_Rotation_Click()
On Error GoTo Err_A_Rotation_Click
Update tbl_roster
Set Status = "off day"
WHERE Shift = "b-days"
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Frm_Roster"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_A_Rotation_Click:
Exit Sub
Err_A_Rotation_Click:
MsgBox Err.Description
Resume Exit_A_Rotation_Click
End Sub
As John says, there are two languages involved: SQL and VBA. I provided a
sql statement that you could execute by creating a new query in the Queries
pane of the database window, switching to SQL View, typing it in, and
clicking the Execute button on the toolbar.
Since you seem to want to do this via a button click, you need to use ADO,
DAO or DoCmd.RunQuery to run this sql statement. Here is how to do it via
ADO:
Dim cn as ADODB.Connection,sql as string
Set cn = CurrentProject.AccessConnection
sql="Update tbl_roster Set Status = 'off day' " & _
"WHERE Shift = 'b-days'"
cn.execute sql,,adCmdText + adExecuteNoRecords
Set cn = nothing