|
-
Feb 13th, 2001, 12:25 AM
#1
Thread Starter
Hyperactive Member
How can I enter the parameters for a search on one form, run an SQL query, and pull up another form with a flexgrid displaying the results of the search. I'm confused as to how to transfer the results of the search to the other form and populate the grid (10 fields per record) one record at a time.I would appreciate any help.
A cynic knows the price of everything but the value of nothing.
-
Feb 13th, 2001, 09:23 AM
#2
Hyperactive Member
Do you know how to use the flexgrid to display
your results? That would be the first thing to
do. Other than that, I am not sure, but think
you should be able to set your SQL so that
it is global to your project. Once the user click the
QUery form, it then does the search. Once it found
the result, you can call the Display form (form2.show)
to show your result.
-
Feb 13th, 2001, 09:05 PM
#3
Well ...
Yes, the important thing is to know how records can be displayed in the FlexGrid. Apart from that, here are a few things you might try:
1. Declare a string variable global to your project. In your query form, set this string variable to the appropriate query string and invoke the Grid form. In the grid form, use this string variable to open a recordset and populate the grid.
2. Declare a recordset object public to your project. In your query form, open this recordset with the appropriate SQL statement and then call the grid form, which will simply use this recordset to populate the grid.
3. Open the recordset in your query form, then access the grid control on the grid form to populate it from the query form itself, and once the control is populated, show the grid form.
4. Declare public variables in the grid form for all the parameters that you require. From the query form, set the values of these public variables to the parameter values accepted in the query form, and then show the grid form. In the grid form, use these variables to frame the SQL statement, open the recordset and populate the grid.
There may be more ways, but I guess this much will be more than enough.
.
-
Feb 13th, 2001, 10:18 PM
#4
PowerPoster
You can do this way
I am not going to write the whole thing to get the sql query but I am just going to tell that how to get the text from the other form. Let us say that you have a text box on the form named "Form2", and you want to get the sql query from that text box in "form1".
Dim thequery as string
thequery = form2.controls.text1.text
New thequery has the sql query form the textbox on form2.The name of form and textbox could be varried.
I think that is what you were talking about!
-
Feb 14th, 2001, 04:45 AM
#5
Well ...
abdul, you can access the Text1 on Form2 just by saying
instead of accessing the .Controls collection of Form2.
Your method is correct, but in real life, textboxes would be used only to get parts of the query, like which fieldnames to retrieve and so on. If a user was to write the entire query in a textbox, your approach would work fine.
.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|