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

Combo box form trouble... 1

Status
Not open for further replies.

JasonPurdueEE

Technical User
May 21, 2002
131
US
Hello. I am working on a form where I need to select some criteria with a combo box and display the results (the rest of the record). depending on what is selected, one or more records may match that criteria. I need to display all of the records that fit the bill. Some of you may remember my cascading combo boxes post last week. in that I used the RecordsetClone.FindFirst and RecordsetClone.Bookmark method, but I cant see how this will work in this situation (because I want more that the first match as I may get one or many matching records). can anybody give me a nudge in the right direction as to how I'm going to get ths to work? if you would like clarification, please let me know. thank you.

JASON
 
Hi Jason:

Are the other fields that you want to display bound or unbound?

When you say display all the records that fit the bill, are you referring to a continuous form? Otherwise, how can you display more than one record at a time on the form?

Is the form bound or unbound?

Hope all is well,
dz
 
Hi FoxPro.
The form will be bound to a table. I think the combo box will be unbound and the rest of the fields will be bound to the table. I'm not sure how to display all the records at one time. what exactly is meant by continuous form? it sounds like I may need to use such a thing in this situation...
 
ok, I figured out what a continuous form is. this is exactly what I need to make. so whats the best way to go about getting the data matching the criteria selected from the combo box into the continuous sub form?
 
Jason,

You need to relate the tables and use a subform. Create the subform just like you would any other form. Set the default view to Continuous Forms. Then create your main form and select the subform tool. Insert the subform object, and set the Source Object (on the Data tab) to the name of your subform. You might decide that a list box on the subform will work better than a continuous form. It really depends on what you are trying to display, and if you want to allow changes to the table. If you are simply trying to display data (no edits allowed), a list box might work better. dz
 
ahh, the list box is just what I need (because I dont want to be able to edit this data, just display it). I built the subform, but am having some trouble getting the combo box to be the criteria in the subform. heres what I have so far:

Forms:
PSR_Form
PSR_Form_Subform

Table: VarianceCommentary

my combo box is unbound and the control source is the following: SELECT DISTINCT [VarianceCommentary].[PWR] FROM [VarianceCommentary];

I'm having a hard time getting the subform to display the data. I've tried a couple things, none of which worked. How do I set it up to display the records that match the criteria selected from the combo box? Thank you.

JASON



 
When I read your last post, it doesn't sound like you have related tables. If so, you don't need a subform. The form can have a combo box and list box. In the After Update event of the combo box, set the RowSource of the list box with a query.

Dim strQuery as String

strQuery = "SELECT DISTINCT [VarianceCommentary].[PWR] FROM [VarianceCommentary] Where somefld = " & Chr(34) & cmbobox.Value & Chr(34) & ";"

lstbox.RowSource = strQuery

I don't know what somefld is from what you posted. It is the field in the table that contains the data in the combo box.



dz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top