Open Related Form When Click Field (1 Viewer)

scouser

Registered User.
Local time
Today, 10:05
Joined
Nov 25, 2003
Messages
767
Hi. I would like to open Form B when a field is clicked in Form A.

Form A = frmCustomerOrderHistory1 (OrderID)
Form B = frmSalesOrders

When user clicks OrderHistory (OrderID) I would like frmSalesOrders to open displaying the corresponding Order.

I have tried:

DoCmd.OpenForm frmSalesOrders, acNormal, [Forms]![frmCustomerOrderHistory1]![OrderID] = [Forms]![frmSalesOrders]![OrderID], , acFormEdit, acWindowNormal

Any help much appreciated.
Phil.
 

Ranman256

Well-known member
Local time
Today, 05:05
Joined
Apr 9, 2015
Messages
4,337
the 1st part of the where clause is the field,
the 2nd is the textbox on the form. no need for the full path, since you are already in the form.

DoCmd.OpenForm frmSalesOrders, acNormal, "[OrderID] = " & txtOrderID
 

scouser

Registered User.
Local time
Today, 10:05
Joined
Nov 25, 2003
Messages
767
OK, I have resolved.

DoCmd.OpenForm "frmSalesOrders", , , "OrderID = " & OrderID.Value
Phil.
 

scouser

Registered User.
Local time
Today, 10:05
Joined
Nov 25, 2003
Messages
767
Hi. Just seen your post, that was quick! I managed resolve in the meantime. Thanks.
Phil.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 10:05
Joined
Feb 19, 2013
Messages
16,612
try

DoCmd.OpenForm "frmSalesOrders",,, "[OrderID] = " & [OrderID], , acFormEdit, acWindowNormal
 

Users who are viewing this thread

Top Bottom