DIVINEDAR0956
IS-IT--Management
I have the following procedure and it gives the error message "OBJECT VARIABLE OR WITH BLOCK VARIABLE NOT SET"
Private Sub Command109_Click()
On Error GoTo Err_Command109_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim obCheckProject As Object
Dim obCheckStoreProject As Object
Dim stDocNameA As String
stDocName = "frEditTaskHours"
stDocNameA = "frStoreProject"
Set obCheckProject = "qryCheckProject"
Set obCheckStoreProject = "qryCheckStoreProject"
stLinkCriteria = "[JOBNUMBER]=" & "'" & Me![JobNumber] & "'"
DoCmd.OpenQuery "qryCheckProject", acViewNormal, acEdit
DoCmd.OpenQuery "qryCheckStoreProject", acViewNormal, acEdit
If obCheckProject = obCheckStoreProject Then
DoCmd.OpenQuery "DltProject", acViewNormal, acEdit
DoCmd.OpenQuery "apStoreProjectToProject", acViewNormal, acEdit
Else
DoCmd.OpenQuery "apProjectToStoreProject", acViewNormal, acEdit
End If
DoCmd.Close acQuery, "DltProjectFromStoreProject", acSaveYes
DoCmd.Close acQuery, "apProjectToStoreProject", acSaveYes
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.OpenForm stDocNameA, , , stLinkCriteria
Exit_Command109_Click:
Exit Sub
Err_Command109_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command109_Click
End Sub
If someone can tell me what's my problem to get this procedure to run without the error would be most appreciated. Also if there is an easier way to rewrite this procedure please advise.
Darlene Sippio
dsippio@comtechsystems.com
Private Sub Command109_Click()
On Error GoTo Err_Command109_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim obCheckProject As Object
Dim obCheckStoreProject As Object
Dim stDocNameA As String
stDocName = "frEditTaskHours"
stDocNameA = "frStoreProject"
Set obCheckProject = "qryCheckProject"
Set obCheckStoreProject = "qryCheckStoreProject"
stLinkCriteria = "[JOBNUMBER]=" & "'" & Me![JobNumber] & "'"
DoCmd.OpenQuery "qryCheckProject", acViewNormal, acEdit
DoCmd.OpenQuery "qryCheckStoreProject", acViewNormal, acEdit
If obCheckProject = obCheckStoreProject Then
DoCmd.OpenQuery "DltProject", acViewNormal, acEdit
DoCmd.OpenQuery "apStoreProjectToProject", acViewNormal, acEdit
Else
DoCmd.OpenQuery "apProjectToStoreProject", acViewNormal, acEdit
End If
DoCmd.Close acQuery, "DltProjectFromStoreProject", acSaveYes
DoCmd.Close acQuery, "apProjectToStoreProject", acSaveYes
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.OpenForm stDocNameA, , , stLinkCriteria
Exit_Command109_Click:
Exit Sub
Err_Command109_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command109_Click
End Sub
If someone can tell me what's my problem to get this procedure to run without the error would be most appreciated. Also if there is an easier way to rewrite this procedure please advise.
Darlene Sippio
dsippio@comtechsystems.com