How do I open a popup form at the right record?

Robert C

Registered User.
Local time
Today, 12:22
Joined
Mar 27, 2000
Messages
88
I have a button on a form - frmOrders - which opens a popup form - frmDeliveryDetails. A relationship exists between the two via the OrderID field. I want this button to open the frmDeliveryDetails at the appropriate record according to that displayed when the button is clicked. At the moment the right OrderID is displayed, but the other fields, Address, Post Code, etc, on the popup form do not appear.

The code I am using at the moment is as follows:-

Private Sub btnCheckDelAddress_Click()
On Error GoTo Err_btnCheckDelAddress_Click

Dim stDocName As String

stDocName = "frmDeliveryDetails"

DoCmd.OpenForm stDocName, , "[OrderID]=" = Me!OrderID, acFormEdit

Exit_btnCheckDelAddress_Click:
Exit Sub

Err_btnCheckDelAddress_Click:
MsgBox Err.Description
Resume Exit_btnCheckDelAddress_Click

End Sub

Any help would be greatly appreciated.
 
Hi Robert C

Does the query that this PopUp form draws upon have all these other details within it? If the query does not contain Address1, Town, ZipCode etc then the PopUp form cannot display this information.

HTH

Rich
 
Hi Rich

Thanks for the reply. The form is based on a table - tblDeliveryDetails - which does have all these fields.
 
Hi Robert C

Try similar coding to below

Dim DocName As String
Dim LinkCriteria As String

DocName = "frmDeliveryDetails"
LinkCriteria = "[OrderID] = Forms![frmOrders]![OrderID]"
DoCmd.OpenForm DocName, , , LinkCriteria

This works for me in similar situations.

HTH

Rich
 

Users who are viewing this thread

Back
Top Bottom