473,889 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

11 New Member
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 19662
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
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,584 Recognized Expert Moderator MVP
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

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

Similar topics

2
2869
by: Maggie Eusebio Schock | last post by:
Hi, I would like to understand when a selected cell, selected row or selected rows in the DataGrid control ends up on the clipboard. All I know is that the selection ends up on the clipboard, because when I issue a copy command then paste to an editor, the selected datagrid cell(s) end up on the editor. Maybe a better way of stating my question is during what event (e.g. MouseUp) do the selected cells end up on the clipboard (I...
2
2605
by: Targa | last post by:
I have a select box with about 5 options. I need to have one of the options, when selected, display a second select box. The second select box is populated by a database and needs to be preloaded so the page doesnt refresh. How can this be done? I guess could have the second select box displayed but disabled and it would become active once the option is selected on the first select box.
0
1303
by: Jim Jaworski | last post by:
I have a page of archived newspaper articles. This week I did the "good thing" and placed them in a <div id="content"> wrapper. Now when I select an item the page blinks in Mozilla. I'm worried about this because it could affect some people with health problems related to frequent blinking displays. I also have anoter problem, this time with the home page. It looks fine in both Mozilla 1.8.6 and IE 6 ... but nooooo in Firefox.
0
5582
by: sam | last post by:
I have 2 radio buttons on my form which are hidden. I need to have these radio buttons visible once a checkbox is selected. The radio buttons are hidden on loading of the form but I cannot make them visible once the check box is checked. The error I get is 'document.radiology.rcontmedia.style' is null or not an object. The code I am using is below. Please note that I have no previous experience programming in javascript. function...
2
10707
by: jpalmerx | last post by:
Hi, I have a form in Access with a listbox containing some choices. There is a "Select" button underneath that runs a macro opening a form that acts on the selected value. What I can't figure out is how to display an error, eg. "Please make a selection" if nothing is selected and the "Select" button is clicked. I'm trying an If Then Else statement worked into the button such as: If listbox value=null, then error message. Else, run...
1
1202
by: Charles Shao | last post by:
How to chang bgcolor of row when mouse selected a row? I have a HTML table in the page. I hope to change <tr.bgcolor> when user clicks on a column, just like user has selected this row. How can I do that ? Thanks Charles Shao:-)
1
1027
by: Robert A. Boudra | last post by:
As a newcomer to .Net I'm continually frustrated with the subtle and not so subtle changes that have been made since VB 6.0 that don't seem to server any real purpose other than to frustrate people like me. In any case, I'm trying to do something as simple as take an action when the user selects an item from a combo box. I've tried using the SelectedIndexChange event, but that fires several times while the list is being populated etc....
2
4455
by: Alan Silver | last post by:
Hello, I have a pair of radiobuttons on a form, used to select the type of search someone is to do... <asp:RadioButton ID="rdbLastNDays" Text="Show tips for the last" GroupName="rbgSearch" runat="server" /> and
1
8072
by: jobs | last post by:
I can't seem to get selectedrowstyle-backcolor to set the row background color unless I force the selected index in the code behind. When i select the ButtonField Run button it does set the background color for the row. Is there another property I need to set to allow selection for this to work? </div> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"...
2
2575
by: idontknow | last post by:
I have the following code : $form = "<head><title>:::Subjects:::</title></head> <script src='ajax_files/prototype.js'></script> <script src='ajax_files/getSecond.js'></script> <body> <form action='subjects.php' method='get' enctype='multipart/form-data'> <table width='394' border='1' align='center' cellpadding='5' cellspacing='5'> <tr> <td>Programe Name:</td>";
0
9961
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10784
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10887
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10439
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7991
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6021
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4642
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4248
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3252
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.