09-03-12, 17:46 #1Registered User
- Join Date
- Apr 2012
Unanswered: How could I transfer values into bound textboxes on a form?
I have a subform that is bound to a table. The first two fields on the form are EmployeeID and CompanyNameID (which follows the structure of the table). Subform is set to continuous.
The subform doesn't have any parent child relationship with the mainform that contains it.
I want to programmaticly have the values for the first two fields transfered into these two textboxes using their OnFocus properties; basically as the user tabs past the two boxes their values are filled in via code.
I am planning to have the values transfered from a query that looks up the CompanyNameID based on the EmployeeID; so the query is returning two values. User supplies the EmployeeID at a "LogIn" form that is always open.
It's important that the values transfer into the two textboxes for one record, not a million records automagically, so that only the textboxes that have had focus are having values added into them one record at a time.
Any ideas and/or example code would be very helpful.
09-04-12, 07:59 #2Grumpy old man (training)
Provided Answers: 8
- Join Date
- Sep 2006
- Surrey, UK
This doesn't make a lot of sense. For the most parts, a subform is used to show values that are related to the contents of the parent form, but from a different table (e.g. employee details and employment post history). If you have not defined parent/child relationships between the parent form and subform, how do you propose to control which records are displayed in the subform?
Also, if you want to display values from a query in the subform, why is it bound to a table?
I suggest that you hold the employee's ID in the main form, along with the looked-up company name ID. Then you can use those controls to create the parent/child links with the subform, which would therefore be restricted to the details of the logged in employee.10% of magic is knowing something that no-one else does. The rest is misdirection.
Beers earned: 1