G
Guest
I have a button on my main form frmOrders with the following in the onclick
event:
Private Sub btnFreight_Click()
On Error GoTo Err_btnFreight_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmOrderLoads"
stLinkCriteria = "[OrderID]=" & Me![OrderID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_btnFreight_Click:
Exit Sub
Err_btnFreight_Click:
MsgBox Err.Description
Resume Exit_btnFreight_Click
End Sub
It opens the frmOrderLoads form and displays the records related to current
OrderID.
However, what I want to acheive is add some lines to the above procedure so
that if there is no existing records in the frmOrderLoads for the current
OrderID then it should automatically create a new record with current
OrderID.....
Can anyone help me out on that please?
Thanks in advance.
event:
Private Sub btnFreight_Click()
On Error GoTo Err_btnFreight_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmOrderLoads"
stLinkCriteria = "[OrderID]=" & Me![OrderID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_btnFreight_Click:
Exit Sub
Err_btnFreight_Click:
MsgBox Err.Description
Resume Exit_btnFreight_Click
End Sub
It opens the frmOrderLoads form and displays the records related to current
OrderID.
However, what I want to acheive is add some lines to the above procedure so
that if there is no existing records in the frmOrderLoads for the current
OrderID then it should automatically create a new record with current
OrderID.....
Can anyone help me out on that please?
Thanks in advance.