Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

INSERT VBA code

I have a subform with 10 date fields on it.  And I want to insert the values of those dates fields into a table named tblDeliverydates using INSERT.  This isn't right.  Can someone help?

    Dim DeliveryDate As Date

    INSERT INTO tblDeliveryDates (DeliveryDate) VALUES (DelDate1, DelDate2, DelDate3, DelDate4, DelDate5, DelDate6, DelDate7, DelDate8,ReskedDate9, ReskedDate10)

Open in new window


Note:  If it matters, sometimes one or more if the date fields may be empty.
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
BTW,

Any time you use a number like this in a field name, it is a good indication that you have a poor table design.  Instead of 10 columns like this, you should have a separate table which contains the PK from the main record, and then maybe a SeqNum field (with values 1-N), and the DelDate (date) column.

Then you could display this data in a bound subform, rather than an unbound form. And it would also be easier to retrieve or analyze the data than with 10 separate columns.

Dale