when I click on the button, SQL update runs fine. but when it gets to insert query - it is displaying Run Time Error 424 object required.
Immediate window shows insert SQL query - if I run the query itself, it runs fine. I am totally stuck!!!!
Private Sub Command32_Click()
Dim intEntityID As Long
Dim intuserid As Long
Dim intcontactid As Long
Dim intpersonid As Long
Dim strFY11Access As String
Dim strType As String
intEntityID = [Forms]![frmEntityUsers].[EntityID]
intuserid = [Forms]![frmEntityUsers].[UserID]
intcontactid = [Forms]![frmEntityUsers].[ContactID]
intpersonid = [Forms]![frmEntityUsers].[PersonID]
Dim strupdateAccess As String
Dim strQuery As String
strFY11Access = [Forms]![frmEntityUsers].[FY11GMEAccess]
If Len(strFY11Access) > 0 Then
strFY11Access = [Forms]![frmEntityUsers].[FY11GMEAccess]
Else
strFY11Access = "No LEA Access"
End If
Debug.Print strFY11Access
strupdateAccess = "Update tblUsers Set FY11GMEAccess = '" & strFY11Access & "' where userid = " & intuserid & ";"
Debug.Print strupdateAccess
DoCmd.RunSQL strupdateAccess
Dim strGME As String
If strFY11Access = "GSA Signer" Then
strGME = "LS"
ElseIf strFY11Access = "LEA Capture Only" Then
strGME = "LC"
ElseIf strFY11Access = "County GSA Signer" Then
strGME = "CS"
Else
strGME = "No LEA Access"
End If
Debug.Print strGME
If strGME <> "No LEA Access" Then
strQuery = "Insert into dbo_GMEcEntityUsers Select 2011, EntityID,UserID, ContactID, PersonID, '" & strGME & "' from TempEntityUsers where userid = " & intuserid & ";"
Debug.Print strQuery
DoComd.RunSQL strQuery
Else
End If
End Sub
Immediate window shows insert SQL query - if I run the query itself, it runs fine. I am totally stuck!!!!
Private Sub Command32_Click()
Dim intEntityID As Long
Dim intuserid As Long
Dim intcontactid As Long
Dim intpersonid As Long
Dim strFY11Access As String
Dim strType As String
intEntityID = [Forms]![frmEntityUsers].[EntityID]
intuserid = [Forms]![frmEntityUsers].[UserID]
intcontactid = [Forms]![frmEntityUsers].[ContactID]
intpersonid = [Forms]![frmEntityUsers].[PersonID]
Dim strupdateAccess As String
Dim strQuery As String
strFY11Access = [Forms]![frmEntityUsers].[FY11GMEAccess]
If Len(strFY11Access) > 0 Then
strFY11Access = [Forms]![frmEntityUsers].[FY11GMEAccess]
Else
strFY11Access = "No LEA Access"
End If
Debug.Print strFY11Access
strupdateAccess = "Update tblUsers Set FY11GMEAccess = '" & strFY11Access & "' where userid = " & intuserid & ";"
Debug.Print strupdateAccess
DoCmd.RunSQL strupdateAccess
Dim strGME As String
If strFY11Access = "GSA Signer" Then
strGME = "LS"
ElseIf strFY11Access = "LEA Capture Only" Then
strGME = "LC"
ElseIf strFY11Access = "County GSA Signer" Then
strGME = "CS"
Else
strGME = "No LEA Access"
End If
Debug.Print strGME
If strGME <> "No LEA Access" Then
strQuery = "Insert into dbo_GMEcEntityUsers Select 2011, EntityID,UserID, ContactID, PersonID, '" & strGME & "' from TempEntityUsers where userid = " & intuserid & ";"
Debug.Print strQuery
DoComd.RunSQL strQuery
Else
End If
End Sub