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

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

P: 11
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
Share this Question
Share on Google+
2 Replies

Expert Mod 100+
P: 2,321
Set the default value of the field in the table to 0. Do the same for the combo box.
Dec 5 '11 #2

Expert Mod 15k+
P: 31,754
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.