Hello, I have a test update query that I created and need to convert it to VBA - SQL so I can run it using a button in my form plus I need to learn this anyway... First is there a website that explains this? Second I have trouble with things like referring to controls on a form like:
SupervisorID =[forms]![frm_UpdateSupIn fo]![txtSupervisorID]
Im using this behind my form so can I use Me.txtSuperviso rID or do I have to do the whole thing?
TEST Query SQL that works:
What I came up with:
SupervisorID =[forms]![frm_UpdateSupIn fo]![txtSupervisorID]
Im using this behind my form so can I use Me.txtSuperviso rID or do I have to do the whole thing?
TEST Query SQL that works:
Code:
UPDATE tbluEmployees SET tbluEmployees.SupervisorID = [Forms]![frm_UpdateSupInfo]![cboSupervisor] WHERE (((tbluEmployees.SupervisorID)=[forms]![frm_UpdateSupInfo]![txtSupervisorID]));
What I came up with:
Code:
Dim strSQL As String
strSQL = " UPDATE tbluEmployees SET tbluEmployees.SupervisorID = [Forms]![frm_UpdateSupInfo]![cboSupervisor] "
strSQL = strSQL & "WHERE (((tbluEmployees.SupervisorID)=[forms]![frm_UpdateSupInfo]![txtSupervisorID]))"
'verify the SQL works
Debug.Print strSQL
'CurrentDb.Execute strSQL
Comment