469,342 Members | 6,455 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,342 developers. It's quick & easy.

How can I add a '0' when no number is selected

Hi there,

I have a vba query that inserts the data from a form into a table.

I have 4 combo boxes that users can select values 0 to 10 from another table, how can I get either the combo box to select '0' when the form first opens?

or how do I get the insert into to add a '0' if the user doesn't select a number from the combo box

my SQL code is this:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunSQL "INSERT INTO Customers_Daily ([First Name],[Under 6 Mths],[6 - 11 Mths],[1 - 4 Yrs],[5 Yrs +],[Clocked In]) VALUES ([First_Name],[Under 6 Mths],[6 - 11 Mths],[1 - 4 Yrs],[5 Yrs +],[ClockedIn]);"
The combo boxes are named (Under 6 Mths, 6 - 11 Mths, 1 - 4 Yrs, 5 Yrs +)

Many Thanks
Dec 5 '11 #1
2 13984
TheSmileyCoder
2,321 Expert Mod 2GB
Set the default value of the field in the table to 0. Do the same for the combo box.
Dec 5 '11 #2
NeoPa
32,182 Expert Mod 16PB
Don't even go there Will (with your design rather than Smiley's answer of course).

Access provides a perfectly good form interface for managing data in tables. Use that instead of trying to create your own. This issue is entirely as a result of trying to go the long way around.
Dec 5 '11 #3

Post your reply

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

Similar topics

2 posts views Thread by Maggie Eusebio Schock | last post: by
2 posts views Thread by Targa | last post: by
reply views Thread by Jim Jaworski | last post: by
1 post views Thread by Charles Shao | last post: by
1 post views Thread by Robert A. Boudra | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.