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

Form controls won't bind to recordset - why?

Status
Not open for further replies.

shauntwo

Technical User
Jul 9, 2002
64
0
0
US
To be brief, my situation is this: I have a main form with several text and combo boxes, as well as a subform, and the form's operations are driven by a binary option group, as follows:

If option 1 is selected, all controls are programmatically unbound, the form's recordset is dumped, and the controls are used for creating a new record. The associated subform is linked via child and master to reflect existing records that share an account number identical to that specified in one of the main form's controls. The values are inserted to the underlying table programmatically using AddNew and Update methods with a recordset.

If option 2 is selected, the main form's controls become search parameters so that the user can search for existing records (a query, essentially), and the "resultset" is reflected in the subform. To do this, the subform's child and master values are deleted, and its recordset is dynamically built based upon the values of the controls specified, once the user clicks a "Search" button. With the resulting recordset in the subform, I'd like the user to click on any record (I have an On_Current event for the subform with this) to see the record details in the controls of the main form. In other words, I'm trying to programmatically "reverse" the main form / subform relationship.

My problem is, even after explicitly giving the main form a new recordset, and after binding all the controls to fields, my controls all remain empty. My purpose of this action is to give the user the ability to edit existing records using the main form's controls - but it's not working.

Any insight here would be GREAT.
 
And Refresh or ReQuery to no avail ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
I actually discovered the culprit shortly after posting the note - the form was initialized for Me.DataEntry = True, which prevented the controls from being bound to an underlying recordsource. After setting the DataEntry property to False, it worked like a charm. Of course, I ran into some other issues as a result, but that's to be expected.

Thanks again for your note.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top