J
jwrnana
I have an order entry database. Form Orders by Customer is where I enter
customer info first, then click on Orders at bottom of screen to take me to
second form, Orders, to enter product information, and ship to info. When I
click on Orders at bottom of screen, I get message
Run Time Error '2109'
No field named 'Orders' in current record.
when I debug, END IF ( first end if directly below Employee ID) is
highlighted in yellow. Following is VB information. Originally, I got the
message and Employee ID was highlighted. I changed to Orders (not knowing
what I was doing), still got error and then changed back to Employee ID.
I am not very familiar with VB information. Please advise what I need to
look for or do.
Many thanks in advance.
JR
Private Sub Form_Current()
If IsNull(Me![OrderID]) Then
DoCmd.GoToControl "EmployeeID"
End If
End Sub
Private Sub Form_Open(Cancel As Integer)
If Not IsLoaded("Orders by Customer") Then
MsgBox "Open the Orders form using the Orders button on the Orders
by Customer form."
Cancel = True
End If
End Sub
Private Sub Form_Activate()
On Error GoTo Err_Form_Activate
Me.Requery
If IsLoaded("Orders by Customer") Then
If Forms![Orders by Customer]![Orders by Customer
Subform].Form.RecordsetClone.RecordCount > 0 Then
DoCmd.GoToControl "OrderID"
DoCmd.FindRecord Forms![Orders by Customer]![Orders by Customer
Subform].Form![OrderID]
End If
End If
Exit_Form_Activate:
Exit Sub
Err_Form_Activate:
MsgBox Err.Description
Resume Exit_Form_Activate
End Sub
Private Sub EmployeeID_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub
Private Sub EmployeeID_DblClick(Cancel As Integer)
On Error GoTo Err_EmployeeID_DblClick
Dim lngProductID As Long
If IsNull(Me![EmployeeID]) Then
Me![EmployeeID].Text = ""
Else
lngProductID = Me![EmployeeID]
Me![EmployeeID] = Null
End If
DoCmd.OpenForm "Employees", , , , , acDialog, "GotoNew"
Me![EmployeeID].Requery
If lngProductID <> 0 Then Me![EmployeeID] = lngProductID
Exit_EmployeeID_DblClick:
Exit Sub
Err_EmployeeID_DblClick:
MsgBox Err.Description
Resume Exit_EmployeeID_DblClick
End Sub
Private Sub Order_Details_Subform_Enter()
On Error GoTo Err_Order_Details_Subform_Enter
If IsNull(Me![OrderID]) Then
Me![OrderDate] = Date
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
End If
Exit_Order_Details_Subform_Enter:
Exit Sub
Err_Order_Details_Subform_Enter:
MsgBox Err.Description
Resume Exit_Order_Details_Subform_Enter
End Sub
Private Sub ShippingMethodID_NotInList(NewData As String, Response As
Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub
Private Sub ShippingMethodID_DblClick(Cancel As Integer)
On Error GoTo Err_ShippingMethodID_DblClick
Dim lngShippingMethodID As Long
If IsNull(Me![ShippingMethodID]) Then
Me![ShippingMethodID].Text = ""
Else
lngShippingMethodID = Me![ShippingMethodID]
Me![ShippingMethodID] = Null
End If
DoCmd.OpenForm "Shipping Methods", , , , , acDialog, "GotoNew"
Me![ShippingMethodID].Requery
If lngShippingMethodID <> 0 Then Me![ShippingMethodID] =
lngShippingMethodID
Exit_ShippingMethodID_DblClick:
Exit Sub
Err_ShippingMethodID_DblClick:
MsgBox Err.Description
Resume Exit_ShippingMethodID_DblClick
End Sub
Private Sub ShippingOptions_Click()
On Error GoTo Err_ShippingOptions_Click
If IsNull(Me![OrderID]) Then
Me![OrderDate] = Date
End If
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenForm "Shipping Information", , , "[OrderID] =
forms![Orders]![OrderID]", , acDialog
Exit_ShippingOptions_Click:
Exit Sub
Err_ShippingOptions_Click:
MsgBox Err.Description
Resume Exit_ShippingOptions_Click
End Sub
Private Sub Command30_Click()
On Error GoTo Err_Command30_Click
DoCmd.Close
Exit_Command30_Click:
Exit Sub
Err_Command30_Click:
MsgBox Err.Description
Resume Exit_Command30_Click
End Sub
customer info first, then click on Orders at bottom of screen to take me to
second form, Orders, to enter product information, and ship to info. When I
click on Orders at bottom of screen, I get message
Run Time Error '2109'
No field named 'Orders' in current record.
when I debug, END IF ( first end if directly below Employee ID) is
highlighted in yellow. Following is VB information. Originally, I got the
message and Employee ID was highlighted. I changed to Orders (not knowing
what I was doing), still got error and then changed back to Employee ID.
I am not very familiar with VB information. Please advise what I need to
look for or do.
Many thanks in advance.
JR
Private Sub Form_Current()
If IsNull(Me![OrderID]) Then
DoCmd.GoToControl "EmployeeID"
End If
End Sub
Private Sub Form_Open(Cancel As Integer)
If Not IsLoaded("Orders by Customer") Then
MsgBox "Open the Orders form using the Orders button on the Orders
by Customer form."
Cancel = True
End If
End Sub
Private Sub Form_Activate()
On Error GoTo Err_Form_Activate
Me.Requery
If IsLoaded("Orders by Customer") Then
If Forms![Orders by Customer]![Orders by Customer
Subform].Form.RecordsetClone.RecordCount > 0 Then
DoCmd.GoToControl "OrderID"
DoCmd.FindRecord Forms![Orders by Customer]![Orders by Customer
Subform].Form![OrderID]
End If
End If
Exit_Form_Activate:
Exit Sub
Err_Form_Activate:
MsgBox Err.Description
Resume Exit_Form_Activate
End Sub
Private Sub EmployeeID_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub
Private Sub EmployeeID_DblClick(Cancel As Integer)
On Error GoTo Err_EmployeeID_DblClick
Dim lngProductID As Long
If IsNull(Me![EmployeeID]) Then
Me![EmployeeID].Text = ""
Else
lngProductID = Me![EmployeeID]
Me![EmployeeID] = Null
End If
DoCmd.OpenForm "Employees", , , , , acDialog, "GotoNew"
Me![EmployeeID].Requery
If lngProductID <> 0 Then Me![EmployeeID] = lngProductID
Exit_EmployeeID_DblClick:
Exit Sub
Err_EmployeeID_DblClick:
MsgBox Err.Description
Resume Exit_EmployeeID_DblClick
End Sub
Private Sub Order_Details_Subform_Enter()
On Error GoTo Err_Order_Details_Subform_Enter
If IsNull(Me![OrderID]) Then
Me![OrderDate] = Date
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
End If
Exit_Order_Details_Subform_Enter:
Exit Sub
Err_Order_Details_Subform_Enter:
MsgBox Err.Description
Resume Exit_Order_Details_Subform_Enter
End Sub
Private Sub ShippingMethodID_NotInList(NewData As String, Response As
Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub
Private Sub ShippingMethodID_DblClick(Cancel As Integer)
On Error GoTo Err_ShippingMethodID_DblClick
Dim lngShippingMethodID As Long
If IsNull(Me![ShippingMethodID]) Then
Me![ShippingMethodID].Text = ""
Else
lngShippingMethodID = Me![ShippingMethodID]
Me![ShippingMethodID] = Null
End If
DoCmd.OpenForm "Shipping Methods", , , , , acDialog, "GotoNew"
Me![ShippingMethodID].Requery
If lngShippingMethodID <> 0 Then Me![ShippingMethodID] =
lngShippingMethodID
Exit_ShippingMethodID_DblClick:
Exit Sub
Err_ShippingMethodID_DblClick:
MsgBox Err.Description
Resume Exit_ShippingMethodID_DblClick
End Sub
Private Sub ShippingOptions_Click()
On Error GoTo Err_ShippingOptions_Click
If IsNull(Me![OrderID]) Then
Me![OrderDate] = Date
End If
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenForm "Shipping Information", , , "[OrderID] =
forms![Orders]![OrderID]", , acDialog
Exit_ShippingOptions_Click:
Exit Sub
Err_ShippingOptions_Click:
MsgBox Err.Description
Resume Exit_ShippingOptions_Click
End Sub
Private Sub Command30_Click()
On Error GoTo Err_Command30_Click
DoCmd.Close
Exit_Command30_Click:
Exit Sub
Err_Command30_Click:
MsgBox Err.Description
Resume Exit_Command30_Click
End Sub