Parameters query

richardn

Registered User.
Local time
Today, 19:03
Joined
Nov 6, 2001
Messages
49
I am interested to build a "dynamic query"
I opened a combo, take data from a table, and showing in this combo for
example the description field records from this table.
When an "afterupdate event" occurs, (it means I selected an item from the
combo box) I want to create a query that takes this item as a parameter and
point to a table according to this parameter.
O.K, I put the top item from the combo in a text box and loading the
parameter in the SQL statement from this text, but when I run the query
DoCmd.OpenQuery "query_name") MS Access opens a dialog box and ask from me
to put in the parameter.
I don't want this dialog, I want the SQL take automatic the parameter.
N.B. Please answer at this email :richardn@iec.co.il
Thanks,
Richard
 
'Make a pointer (instance?) of your query
Set qdf = db.QueryDefs("qry_effect_report_mt")

' Set parameters for query based on values entered
qdf.Parameters![lowdate] = var_low_date
'execute the query
qdf.Execute
 
Thanks, Richard
It helps.
 
Thanks for your help,it works well.
O.K. here is onother problem :
I am interested to add bookmarks to a recordset.
In a list box a have that records from the table I run the parameters query. By clicking each item in the list box, I add that item to a bookmark colection. Unselecting this item deletes the bookmark.
As I said before the items in the lbox, are records from rows in a table , and the bookmark is supoused to point to this row, and after that I want to handle other fields in that pointed row ( by the bookmark).
From my form I call a module where I initiate the bookmark object and building the colection, but when I come back to the form , I can't see the bookmarks. Using "MyForm!bookmark" what am I supoused to get?
I hope you understand my problem, and I ask if there is a better way to do that ( accesing rows in a table according to records from a column from this table, that are listed in a list box)
 

Users who are viewing this thread

Back
Top Bottom