Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

locking current record

Status
Not open for further replies.

nickbrookes

Technical User
May 12, 2001
20
0
0
GB
i've got a form linked to several tables to enter order information and a report linked to this form via a command button. The report is based on a stack of queries, which need the order number to retrieve the relevant information. Is there a way of telling the query which record i'm working on in the form and printing this report automatically without the dialogue box?
 
In the criteria of the query place a reference to the control on your form which holds the order number. So say you had a form named "frmOrders" and a control named "txtOrderNumber". Your query would have a line in the criteria field of Order Number that looks like this:

=[Forms]![frmOrders]![txtOrderNumber]

Hope that helps! Joe Miller
joe.miller@flotech.net
 
Hi!

You may include link criteria in command button Click procedure:

Private Sub cmdPrint_Click()
Dim strLinkCriteria As String
Dim strDocName As String
strDocName = "MyReport"

strLinkCriteria = "MyFieldName=" & Me.txtBox
DoCmd.OpenReport strDocName, acViewPreview, , strLinkCriteria
End Sub

Aivars
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top