J
Jack
Hi,
My data entry form was working just fine until I loaded the production data.
Now I am getting the above error
I cannot figure out why this is happening.
The error is happening in the following code:
Private Sub cboPlants_AfterUpdate()
'On Error GoTo Err_cboPlants_AfterUpdate
Dim strPlants As String
Dim strYear As String
Dim TheDate As Date
Dim strKey As Integer
'Code added
If IsNull(cboPlants) Then
Exit Sub
End If
If IsNull(Me!cboSource1) Then
MsgBox ("Please select the Source")
Me!cboSource1.SetFocus
Else
TheDate = Now()
strPlants = Me!txtPlantCode
strYear = Right(DatePart("yyyy", TheDate), 2)
Me!IDNum = strPlants & strYear
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
strKey = Me.txtKey.Value
Me.IDNum.Value = strPlants & strYear & "-" & strKey
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
End If
Me.cboProductType.Visible = True
Exit Sub
'MsgBox Err.Description
'Resume Exit_cboPlants_AfterUpdate
End Sub
Also the code stops running in the following line:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
I appreciate any help for resolution of this issue. Thanks.
My data entry form was working just fine until I loaded the production data.
Now I am getting the above error
I cannot figure out why this is happening.
The error is happening in the following code:
Private Sub cboPlants_AfterUpdate()
'On Error GoTo Err_cboPlants_AfterUpdate
Dim strPlants As String
Dim strYear As String
Dim TheDate As Date
Dim strKey As Integer
'Code added
If IsNull(cboPlants) Then
Exit Sub
End If
If IsNull(Me!cboSource1) Then
MsgBox ("Please select the Source")
Me!cboSource1.SetFocus
Else
TheDate = Now()
strPlants = Me!txtPlantCode
strYear = Right(DatePart("yyyy", TheDate), 2)
Me!IDNum = strPlants & strYear
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
strKey = Me.txtKey.Value
Me.IDNum.Value = strPlants & strYear & "-" & strKey
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
End If
Me.cboProductType.Visible = True
Exit Sub
'MsgBox Err.Description
'Resume Exit_cboPlants_AfterUpdate
End Sub
Also the code stops running in the following line:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
I appreciate any help for resolution of this issue. Thanks.