What causes docmd methods to not execute? For some reason the docmd method in both the frmShipSwitch and frmShipment code was being moved through without doing anything. For a bit it will work and then if I do something in the code like add a message box it will stop working again. Why would this happen?
At least the gotorecord method works sometimes
I've never used the findrecord method before so I'm not sure what I'm doing wrong. Note that both are popup forms with frmShipSwitch being modal.
Below is code found on button I press on frmShipSwitch to set open args for Shipment
Below is the code contained in the frmShipment Form
At least the gotorecord method works sometimes
I've never used the findrecord method before so I'm not sure what I'm doing wrong. Note that both are popup forms with frmShipSwitch being modal.
Below is code found on button I press on frmShipSwitch to set open args for Shipment
Code:
Private Sub lblOK_Click()
Dim strOrder As String 'variable for the Order Number
Dim strStart As String 'variable for start date range
Dim strEnd As String 'variable for end date range
Dim strfrm As String 'variable for frmShipment
Me.txttest.SetFocus
Me!lblOK.SpecialEffect = 2
strStart = Nz(Me.txtStart, 0)
strEnd = Nz(Me.txtEnd, 0)
strOrder = Nz(Me.txtOrder, 0)
strfrm = "frmShipment"
'--no order number is given use start and end date ranges
If strOrder = 0 Then
'--close the ShipSwitchboard
RunCommand acCmdClose
'--open another popup that shows list of possible shipments ** right now just opens frmShipment**
DoCmd.OpenForm strfrm, , , , , , 2
'--there is an order number given
Else
'--close the ShipSwitchboard
RunCommand acCmdClose
'--open the shipments form
DoCmd.OpenForm strfrm, , , , , , strOrder
End If
End Sub
Below is the code contained in the frmShipment Form
Code:
Private Sub Form_Load()
Dim str As String 'variable for open args
Dim strON As String 'variable for the string with quotes
str = Nz(Me.OpenArgs, 0)
Me.OrderNumber.SetFocus
'--if you arrive from ShipSwich New Shipment
If str = 1 Then
DoCmd.GoToRecord , , acNewRec
'--if you arrive from somewhere else
Else
'--you arrive from object list
If str = 0 Then
DoCmd.GoToRecord , , acNewRec
'--everything else
Else
'--go to the control that will be searched through
strON = Chr(34) & str & Chr(34)
MsgBox "You are finding " & str
Me.OrderNumber.SetFocus
DoCmd.FindRecord , strON, , False, , acCurrent
End If
End If
End Sub