SQL QUERY help

thsoundman

Registered User.
Local time
Today, 09:28
Joined
Sep 4, 2007
Messages
43
Hey! It's almost friday!!! Anyways basically what I need to do is create a query that will grab information from my Panel table based on what I enter in the fields when I hit submit.... now I'm a little sketchy on SQL statements so i think i got the first part of the statement right but I'm not quite sure what to do to finish it. I attached the file to make things simpler. Take a look and let me know I'm sorta sick today so my mind is a little slow. Thanks for all your help guys... making my learning process on this project much easier.
 

Attachments

I would think it would be easier to just use the filter option.

Make a regular query that pulls all of the information from your Panel table.

In your Query form, you will need to set the text boxes control source to the matching field in the query, the form's record source will need to be that query.

When you open the form you can scroll through all the data, but if you want to find something, just right click on the field you want to search and type in what you are looking for in the filter for box. Say the last name Dunkin. It will only show the 3 records that match that.

In fact, you don't really even need a query - you can set the record source to the table itself.

If you don't want people to update the data, just lock the text boxes so they can filter for stuff and see what's there, but not change.
 
Only reason I'm doing it this seemingly "More Difficult" way is because i want the program to look stream lined. The basic page layout I have is sorta a requirement. If doing it the way you said will work then I can do that. So if I create a regular query I can drag all the information over to my page? I want them to be able to type in the information that they want to query can I still do that from the current form that I have?
 
Take a look at what I did here.

Use right click menu on the text boxes and the Filter For as a search.

To remove filter, right click, remove filter.

I disabled additions, edits and deletes on this form, so it's view only.
 

Attachments

Unfortunatly this is to complex for our users. I have to do it through a SQL query. Unforuntaly my query is not working. Perhaps I have some statements incorrect.


This is what I have so far. I thouht about putting the "values" into a variable but i'm not quite sure how to do this. I believe i would have to create an array correct? Not quite sure how you do this in VB. Any help appreciated. I can be contacted via messenger if it's easier for me to explain that way.

strSQL = "SELECT MO, Contractor, LName, FName, Code, Qty, Start, Finish, tdate from Panel where MO, Contractor, LName, FName, Code, Qty, Start, Finish, tdate = qMO.Value, qContractor.Value, qLNname.Value, qFNname.Value, qCode.Value, qQty.Value, qStart.Value, qFinish.Value"
 
Frustration

I broke my query statement down to somthing even smaller like this:

strSQL = "SELECT MO from Panel WHERE MO = '1020';"

This just tells me a RunSQL command requires a SQL statement. I'm not understand how this is not a SQL statement. Anyways this is getting frustrated and it's lunch time.


Unfortunatly this is to complex for our users. I have to do it through a SQL query. Unforuntaly my query is not working. Perhaps I have some statements incorrect.


This is what I have so far. I thouht about putting the "values" into a variable but i'm not quite sure how to do this. I believe i would have to create an array correct? Not quite sure how you do this in VB. Any help appreciated. I can be contacted via messenger if it's easier for me to explain that way.

strSQL = "SELECT MO, Contractor, LName, FName, Code, Qty, Start, Finish, tdate from Panel where MO, Contractor, LName, FName, Code, Qty, Start, Finish, tdate = qMO.Value, qContractor.Value, qLNname.Value, qFNname.Value, qCode.Value, qQty.Value, qStart.Value, qFinish.Value"
 
I don't see strSQL anywhere in the sample except the INSERT query. Which form are we looking at? RunSQL can only be used with action queries, which your SELECT statement is not. Didn't I point you to a nice search form sample db?
 

Users who are viewing this thread

Back
Top Bottom