Opening a Form

H

Hank

I have 2 forms that are tied to the same record. My Key Field is a Customer
Order Number That is Created on the Fly but not autonumber. I didn't use the
2nd. form as a subform because it is as large as the 1st. and really would
not apply to the scheme of things. If I open the 1st. form in edit view and
use the button to navigate to the 2nd. form all is okay. But if I am entering
a New Record, the 2nd form does not populate the Table. How do I adjust my
coding for this. I am kinda lost here. Code for the button follows:

Private Sub Command235_Click()
On Error GoTo Err_Command235_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Logistics & Routing"

stLinkCriteria = "[CustOrderNum]=" & Me![BillOfLadingTxt]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command235_Click:
Exit Sub

Err_Command235_Click:
MsgBox Err.Description
Resume Exit_Command235_Click

End Sub

Thanks
 
R

ruralguy via AccessMonster.com

You will need to save the record before the 2nd form can see it. Before
opening the other form add
If Me.Dirty then Me.Dirty = False
...to save the record.
I have 2 forms that are tied to the same record. My Key Field is a Customer
Order Number That is Created on the Fly but not autonumber. I didn't use the
2nd. form as a subform because it is as large as the 1st. and really would
not apply to the scheme of things. If I open the 1st. form in edit view and
use the button to navigate to the 2nd. form all is okay. But if I am entering
a New Record, the 2nd form does not populate the Table. How do I adjust my
coding for this. I am kinda lost here. Code for the button follows:

Private Sub Command235_Click()
On Error GoTo Err_Command235_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Logistics & Routing"

stLinkCriteria = "[CustOrderNum]=" & Me![BillOfLadingTxt]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command235_Click:
Exit Sub

Err_Command235_Click:
MsgBox Err.Description
Resume Exit_Command235_Click

End Sub

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top