Red6
Registered User.
- Local time
- Today, 21:46
- Joined
- Jan 9, 2003
- Messages
- 28
Hello
I have a form called Input Orders which has a sub form called Orders Details sub form. The Input Orders form is opened via a button on my Customers form. The code for the button is shown below.
Private Sub New_Order_btn_Click()
On Error GoTo Err_New_Order_btn_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Input Orders"
stLinkCriteria = "[CustomerID]=" & "'" & Me![CustomerID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_New_Order_btn_Click:
Exit Sub
Err_New_Order_btn_Click:
MsgBox Err.Description
Resume Exit_New_Order_btn_Click
End Sub
On opening the form via the button, the customer header detail displays correctly in the main Input Orders form, as per the current customer being viewed on the Customers form.
The problem is, that I need the sub form to open unpopulated, i.e. blank, so that a new order can be inputted. What is currently happening is that the subform is showing the details of the first order placed by that customer.
Am I missing something from the code or is there a fundamental problem with what I am trying to do.
Ian
I have a form called Input Orders which has a sub form called Orders Details sub form. The Input Orders form is opened via a button on my Customers form. The code for the button is shown below.
Private Sub New_Order_btn_Click()
On Error GoTo Err_New_Order_btn_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Input Orders"
stLinkCriteria = "[CustomerID]=" & "'" & Me![CustomerID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_New_Order_btn_Click:
Exit Sub
Err_New_Order_btn_Click:
MsgBox Err.Description
Resume Exit_New_Order_btn_Click
End Sub
On opening the form via the button, the customer header detail displays correctly in the main Input Orders form, as per the current customer being viewed on the Customers form.
The problem is, that I need the sub form to open unpopulated, i.e. blank, so that a new order can be inputted. What is currently happening is that the subform is showing the details of the first order placed by that customer.
Am I missing something from the code or is there a fundamental problem with what I am trying to do.
Ian