By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,968 Members | 1,659 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,968 IT Pros & Developers. It's quick & easy.

Can you add a combo box after click a button to a form?

P: 7
I am new to access but i have a little bit of SQL knowledge. I am just wondering if you can add a combo box in a running form without going to design view.

The idea is "I want to borrow an multiple asset from asset table and save the Barcode ID of asset to Borrow Table." However, in a form you are limited on the combo box that you input in design.

Is there any possible way in VBA or SQL query to do this task?
Mar 26 '15 #1
Share this Question
Share on Google+
3 Replies


jforbes
Expert 100+
P: 1,107
Unlike .Net, you can't add controls at Runtime in Access.

You might get what you want by adding some controls and setting the Visible property to False. Then in code, you can set the Visible property to True. Also in code, you can set the ControlSource of a control and it will set the binding on the fly giving you a Late Binding scenario.
Mar 27 '15 #2

P: 7
I found how to make the combo box invisible and visible once you choice an input.

http://bytes.com/topic/access/answer...ox-create-code

However, I am not familiar with late binding in VBA.
Mar 28 '15 #3

jforbes
Expert 100+
P: 1,107
If you have things working for you the way you want, that is great.

The Late Binding Scenario I mentioned isn't a truly Late Binding, but it is very similar and seemed to be the most descriptive way to explain it with out getting too wordy.

The wordy version is that you can place a Control on a Form during design time and leave the Control Source blank. This Control is then considered Unbound (no Control Source). Then after the Form is running, the Control Source can be set in VBA and Access will data bind the Control to the Database field and it will work. Which to me, is pretty amazing. You can then change the Control Source again and again and Access will continue to work. You can even change the Record Source of the Form along with changing the Control Source and Access will continue to work.

This technically isn't Late Binding, probably more of a Data Binding in Code, but again, I was trying not to be too wordy.
Mar 30 '15 #4

Post your reply

Sign in to post your reply or Sign up for a free account.