Control.Add problem

Jhill55

Registered User.
Local time
Today, 11:01
Joined
Apr 14, 2008
Messages
18
Hey guys,
I was hoping to add new labels and comboboxes to my forms using code. My problem is that Me.Control.Add does not work. The problem is with Add, it keeps showing "Method or data member not found". Can anyone help me out with this?
 
Look in VBA help for CreateControl. I think this is what you are looking for
 
The first problem I see with this is Me.Control.Add would attempt to add a control to the current open form, you can't add controls to a form unless it is in design view.

Secondly I don't think that Control.Add statement is valid in Access VBA, check out the CreateControl method.
 
Thanks for the quick responses! This should get me going in the right direction.
 
you are better to design the controls, but make them invisible

then you can set the visible property to true/false as required

its easier than trying to add controls to the form. as placement and control reference is otherwise tricky
 
The controls I want to add are going to be variables depending on the number of fields in given tables. I want to create a tier structure with combos. The first combo will choose a table. Then it will make a new combo with all the records for the first field to choose from. The next combo would then be a subset from that and so on. Basically, choose a widget, then list all colors of that widget, then list all sizes of that widget with given color.
 
you still dont need to create things on vthe fly to do this - its really diificult

just put them where you want them, and set properties as necessary to use them, when you need them
 
I have to agree with gemma; this is an idea fraught with problems! You'll probably spend ten times the energy and time trying to design this kind of one-size-fits all form as you would if you simply created the various forms separately.
 
If your data is normalised then this should make what you want to do straight forward. Have you searched this forum for cascaded Combos
 
That's the route I've been trying to take. I went ahead and created several combos and hid them all. When the user opens a table, I count the fields, list their names as labels and open X combos. I then make a qry to give me the row source. This is the tricky part. There are so many options... Thanks again for all the input.
 
if this is so hard, then instead of trying to do everything in access, just have a super query building all ther stuff your users might want. and let them export it to a spreadsheet

then they can sort filter etc to get what they want

--------
you cant provide every possible eventuality in Access through forms etc - and this is a good alternative to letting users try to design their own queries etc.
 
They want something that is point and click. Most of them don't know excel very well. Plus, I am VERY new to VBA and like learning and doing new things.
 
its not that making it point and click thats the problem - its how far you can take it realistically ...

now if you have a database for your own use, you can write queries etc, to extract information you need as and when.

now in most cases, your users are

a) not capable of doing this necessarily and
b) can damage the database by inappropriate actions

so you insulate your users from this interface, by providing them with forms etc to manage the data

[in the same way that within excel, you may lock certain cells, etc on critical forms]

---------
now this is all very well, but it does make it very hard - even impossible - to allow for every eventuality.

you can hard code lots of forms/reports, but you cant make everything 100% flexible.

hence there are limits, and at some point you HAVE to say, we cant do this in access within the user interface - but here's all the data - find what you are looking for yourself.
 

Users who are viewing this thread

Back
Top Bottom