Open FOrm with SQl statment

DesiUSA

New member
Local time
Yesterday, 17:50
Joined
Jan 14, 2008
Messages
5
Hi all,

I have a report which uses three listbox's to filter data. I use these listbox's to build a dynamic SQL statement depending on the selections.

I am using same SQL statement to generate table view of results(query view)....

But the users like to have form view, instead of table view to make editing easy.
(They want to edit reports before they generate final reports)
So was wondering, is there way I could use the same SQL statement and OpenForm command

I have been trying this for almost three days

Hope Some one has got solution :)
 
Last edited:
Dave,
Thanks for reply....I need to filter the form using SQL statement, that I generate using listbox's.......Do u have any how this can be done.

Thanks
 
I would do a simple form with the combo boxes, then in you query you can reference those boxes and select only the records that match. This is done kinda like a parameter query only it references the combo boxes; ie like Forms!FormName!FieldName. you will need to do this on each field in the query to match what is on your form.
 
Sorry Dave.....I could not relate to your reply.

I have a report which uses three listbox's to filter data. I use these listbox's to build a dynamic SQL statement depending on the selections.

I am using same SQL statement to generate table view of results(query view)....

But the users like to have form view, instead of table view to make editing easy.
(They want to edit reports before they generate final reports)
So was wondering, is there way I could use the same SQL statement and OpenForm command

Thank you guys.....

P.S: sorry for not being clear with my problem statement
 
Last edited:
I am not sure how you could build a form in SQL.
Maybe someone else will chime in here :)
 
Yup OpenForm using SQl statement is all I need.........:(
 
Sorry Dave.....I could not relate to your reply.

I have a report which uses three listbox's to filter data. I use these listbox's to build a dynamic SQL statement depending on the selections.

I am using same SQL statement to generate table view of results(query view)....

But the users like to have form view, instead of table view to make editing easy.
(They want to edit reports before they generate final reports)
So was wondering, is there way I could use the same SQL statement and OpenForm command

Thank you guys.....

P.S: sorry for not being clear with my problem statement

Well assuming all you're changing with list boxes is the WHERE criteria of your query I would create and save a basic query with no WHERE clause then bind a form to that query. Then open the form with the OpenForm method and change its RecordSource property to your dynamic query and requery the form

Code:
Docmd.OpenForm("YourForm")
Forms("YourForm").RecordSource = "YourSQL"
Forms("YourForm").Requery
 
Dude....that was awesome....

I really appreciate that ......Thanks
 

Users who are viewing this thread

Back
Top Bottom