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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using OpenArgs in the control source of a form

Status
Not open for further replies.

Norwich

MIS
Mar 3, 2002
336
GB
Hi,

I'm using OpenArgs to pass the selected date from a form with a calendar control to use in the query of the next opened form.

I've tested that the parameter has been passed correctly with the debugger. The code in this second form recieving the paramater is:

Private Sub Form_Open(Cancel As Integer)
holding = Me.OpenArgs
End Sub


Now, if the form just displays 'holding' as a testbox, then all is fine, however, I'm trying to use 'holding' as a condition of the control source for the record set being displayed. Eg:



SELECT * FROM Pledges_Date
WHERE ((holding)=[Pledges_Date].[pledgedate])
;

But this always results in a dialog box promting for "holding". This entered value is then used for the data selection criteria but the data passed via OpenArgs is the one still displayed in the textbox.

Any ideas on what I'm doing wrong?

Thanks
 
HI,

Yes you should be indicating to the SQL parser that holding is a variable which holds text.

eg

"SELECT * FROM Pledges_Date
WHERE ((" &holding & ")=[Pledges_Date].[pledgedate])"

JohnH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top