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

Just want to look at the SQL!!

Status
Not open for further replies.

Gigi0614

Programmer
Jun 20, 2004
25
0
0
US
My forms seem to be working correctly, but I am amazed, and I don't know how they work!!

Where could I look at the SQL? I'd like to see what the SELECT statement is to pull the records (from a subform), I'd also like to see what the UPDATE or ADD statements look like. Just to be sure everything was the way I thought it was going to be.

Thanks!!
 
When in design view, display the properties window and take a look at the Data tab for Record source.
For the code, press Alt-F11

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
The recordsource for your form can be found in the form properties window. You will either have a table or a query identified from the pick list. If a query you can open the query by clicking the build button to the right. When in the Query Design Windows Select SQL from the dropdown box on the upper left button. This will display the SQL for the query.

As for the Add and Update functions you will have to be more specific as to what you mean. If these are buttons that you have created on your form using the wizard possibily you can look at the Event Procedures behind the buttons. this is where the VBA code is located for all controls.

Please advise if you need more information.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
I guess I'm just making this too complicated!!
I found the data tab of my form, and the Record Source is "procedure" that is the name of my table that these form fields are coming out of.

Then if I position my mouse over the individual fields on the form, and look at the data tag, I get the CONTROL SOURCE, which is I guess, the name of the field that this data is pulling from & updating, am I right?

Am I just making this too hard!! What if you wanted one form to pull in data from muliple tables, and when the user enter the data and press the >> button that it updates different tables. I guess I'd have to right a query for that, huh??

 
Yes, you are correct about that. As you have found out your form is using a table directly as a the record source and your controls are bound to the fields in that table. If you want to link multiple tables together by their common fields you would build a query. In the query can can access multiple tables, link the appropriately and display their fields all on the same row.

If you choose the query process then the RecordSource dropdown property will include tables and queries to be picked from Just pick the query that you have designed and that recordset now becomes the source for the form. This also applies to reports as well.

Post back with any questions you may have on this subject.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
OK COOL!! I think I'm getting the hang of this...where reports and forms are getting their data from. So I can code the query, store it, then in the form recordsource, just point it to the query I wrote. That makes sense.

One more question though, if you don't mind... I dont think I quite understand what "controls" and fields being "bound" and "unbound"....
 
When a form is bound to a table or query recordset(records) this means the form is bound. When you create a control(textbox, combobox, listbox, option group, etc.) on the form this object(control) has a Control Source. If it is left blank then data entered into is not linked back to a field in the RecordSource for updating. If a field is selected from the recordsource list in the Control Source property then when a record is displayed then the value of that records field is also displayed. If then the value is the control is edited or changed then when the record is saved the field will also change.

If a control is left unbound then the only way for that data to get updated to a field in a table is through a query or VBA code.

I hope that his helps you understand a little clearer.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
So "BOUND" fields are updated when the user hits enter on a form. And it gets updated to the Record Source table.
"UNBOUND" means that it is not updating anything when the user hits enter??

Is that right?

Thanks for your help.
 
That is correct. Unbound means they are just textboxes to display something. No connection back to the table or field. Unbound requires VBA code behind a button to update the record through code.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top