Generating controls on a form

msmayhew

New member
Local time
Today, 07:17
Joined
Dec 9, 2005
Messages
5
I posted a similiar post in the 'Forms' area and I hope I'm not 'cross-posting' but I just saw this area and thought the post would be just as relevant.

I have a form that has a row of controls (checkboxes, textboxes, comboboxes, etc) for every 'driver' in a table (SalesDrivers).

I'm actually a VB Programmer messing with Access for the first time. It doesn't look like you can do Control Arrays with VBA.

I'm looking for a way to loop through the drivers in the drivers table and for each driver create a row of controls.

Is this possible with VBA?

Thanks!
 
You can do it with limited ability. The form has to be closed or in design view to add a control (it can't already be opened). Before we go into how to do this, let's look into why you would want to. You may just need a subform/query instead.
 
I'll try to stay brief:

As far as this issue goes, I have to tables: SalesDrivers and SalesDriversData.

The sales drivers table just has two fields. DriverNumber and DriverName. The data table has an ID field (Primary Key), Driver Number, PalletsIn, PalletsOut, CratesIn, CratesOut, etc....

I know, traditionally, the way to update this data table is one record at a time. But the client has requested to have one form with a row of controls for each driver. I have the form set up and it works fine. It has a submit button that executes a SQL statement for each row.

The problem is adding/removing drivers. Right now it would take forever to add a row of controls and name each control, then add the code to execute the SQL statement.

I want to be able to cycle through the drivers in the SalesDrivers table and add each row dynamically.

I hope this better explains the situation.

Michael
 

Users who are viewing this thread

Back
Top Bottom