Home
Forums
New posts
Search forums
Articles
Latest reviews
Search resources
Members
Current visitors
Newsgroups
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
Newsgroups
Microsoft Access
Microsoft Access Form Coding
Default value for Combo box on a Subform
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Marshall Barton, post: 11601517"] If the combo box is in the subform, then you have to refer to it through the subform control (Me refers to the form running the code). Me.[name of subform control].Form.cboTrackSize = getsize You should have gotten a compile error about cboTrackSize being an undeclared variable. Note that If I am correct about the combo box being in the subform, that implies that you do not have the OPTION EXPLICIT statement at the top of the code module. You should make sure **every** module has this statement. Set VBA Tools - Options - Editor tab Require Variable Declaration to make Access insert it automatically in any new modules. Then you can use Debug - Compile to detect this kind of error. (**Never** edit code unless the form is in design view and always use compile after editing any module.) The Open event is too soon to set/get a control's value. Use the Load event instead. If getsize is a control on the main form, then that is probably the line with the error. If the combo box is bound to a field, then you should not set the Value because it would dirty the record. In general, you probably only want to do this for new records, in which case you should set the combo box's DefaultValue instead of its value. [/QUOTE]
Verification
Post reply
Home
Forums
Newsgroups
Microsoft Access
Microsoft Access Form Coding
Default value for Combo box on a Subform
Top