G
Guest
I am trying to open a form and position to the first record in the table and
it's not working correctly. I am first deleting the table and then adding a
record to the table and inserting the userID and authority. Then I want to
open my form to that record. Anyone have any ideas?
Private Sub Accept_Click()
On Error GoTo Err_Accept_Click
Dim strSQL As String
DoCmd.SetWarnings False
DoCmd.Close
strSQL = "DELETE [WorkTable].* FROM [WorkTable];"
DoCmd.RunSQL strSQL
strSQL = "INSERT INTO [WorkTable] ( UserName, Authority )" & _
"SELECT UserID.UserID, UserID.Authority FROM UserID;"
DoCmd.RunSQL strSQL
DoCmd.GoToRecord , "Assign Policy", acLast
DoCmd.OpenForm "Assign Policy", acNormal
Exit_Accept_Click:
Exit Sub
Err_Accept_Click:
MsgBox Err.Description
Resume Exit_Accept_Click
End Sub
it's not working correctly. I am first deleting the table and then adding a
record to the table and inserting the userID and authority. Then I want to
open my form to that record. Anyone have any ideas?
Private Sub Accept_Click()
On Error GoTo Err_Accept_Click
Dim strSQL As String
DoCmd.SetWarnings False
DoCmd.Close
strSQL = "DELETE [WorkTable].* FROM [WorkTable];"
DoCmd.RunSQL strSQL
strSQL = "INSERT INTO [WorkTable] ( UserName, Authority )" & _
"SELECT UserID.UserID, UserID.Authority FROM UserID;"
DoCmd.RunSQL strSQL
DoCmd.GoToRecord , "Assign Policy", acLast
DoCmd.OpenForm "Assign Policy", acNormal
Exit_Accept_Click:
Exit Sub
Err_Accept_Click:
MsgBox Err.Description
Resume Exit_Accept_Click
End Sub