473,471 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Force "Insert Into" to use default values

Hi

I'm using automation in excel to insert a lot of data into an Access
DB. Its all working fine, apart from the fact that the data entry
people occasionally put "n/a" in the cells instead of 0, which
obviously access doesnt like being put into a number field.

I know i can put if statements around every variable to check, but is
there a way to force it to just put the default value for that
particular field (mostly 0, but sometimes it may be different).

Thanks for any suggestions
Paul

Oct 10 '07 #1
2 3390
On Oct 10, 3:58 am, "paulquinlan...@hotmail.com"
<paulquinlan...@hotmail.comwrote:
Hi

I'm using automation in excel to insert a lot of data into an Access
DB. Its all working fine, apart from the fact that the data entry
people occasionally put "n/a" in the cells instead of 0, which
obviously access doesnt like being put into a number field.

I know i can put if statements around every variable to check, but is
there a way to force it to just put the default value for that
particular field (mostly 0, but sometimes it may be different).

Thanks for any suggestions
Paul
What do you mean be default value? You mean if the field has
gibberish, put 0 or some other one-size-fits empty value? How about
something like:
"Select iif(isNumeric([Amount]),[Amount],0) AS Amount2, field2,field3
>From someTable)"
Oct 10 '07 #2
On Wed, 10 Oct 2007 06:56:15 -0700, OldPro <rr*******@sbcglobal.net>
wrote:
>On Oct 10, 3:58 am, "paulquinlan...@hotmail.com"
<paulquinlan...@hotmail.comwrote:
>Hi

I'm using automation in excel to insert a lot of data into an Access
DB. Its all working fine, apart from the fact that the data entry
people occasionally put "n/a" in the cells instead of 0, which
obviously access doesnt like being put into a number field.

I know i can put if statements around every variable to check, but is
there a way to force it to just put the default value for that
particular field (mostly 0, but sometimes it may be different).

Thanks for any suggestions
Paul

What do you mean be default value? You mean if the field has
gibberish, put 0 or some other one-size-fits empty value? How about
something like:
"Select iif(isNumeric([Amount]),[Amount],0) AS Amount2, field2,field3
>>From someTable)"

You need to be =very= careful with the IsNumberic function. It
doesn't always work as expected.

IsNumeric("($1,23,,3.4,,,5,,E67$)") = True
(My thanks to Rick Rothstein for this excellent example.)

Basically, I'll only use IsNumberic when checking a single character.

A better way to do this is to use a function:
Function IsDigitsOnly(NumberIn As Variant) As Boolean
IsDigitsOnly = (NumberIn Like String$(Len(NumberIn), "#"))
End Function
Please Post Any Replies To This Message Back To the Newsgroup.
There are "Lurkers" around who can benefit by our exchange!
Oct 11 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: newbie_mw | last post by:
Hi, I need urgent help with a novice problem. I would appreciate any advice, suggestions... Thanks a lot in advance! Here it is: I created a sign-up sheet (reg.html) where people fill in their...
1
by: newbie_mw | last post by:
Seems my post was buried in more cries for help :-) I will try again. It's probably a very novice question so please take a look! Thanks!...
9
by: Luc Dal | last post by:
Hello, I've serious problem using ASP under WindowsXP sp2. I get the following reply (sorry it's in french) Erreur de compilation Microsoft VBScript error '800a0401' Fin d'instruction...
5
by: Chad Richardson | last post by:
Is there a way in SQL Server 2000 to extract data from a table, such that the result is a text file in the format of "Insert Into..." statements, i.e. if the table has 5 rows, the result would be 5...
2
by: CFW | last post by:
I use the following flawlessly to insert a single field: strSQL = "Insert into (Casket) Values " _ & "(" & conQuote & NewCasket & conQuote & ")" Set db = CurrentDb If MsgBox(NewCasket & " is...
3
by: Ed | last post by:
Hi, I want to load data to a table in Sql Server from a dataset table in my vb.net app using a dataAdapter. I know how to do this as follows (my question is to see if I can reduce the amount...
6
by: Rich | last post by:
Hello, I have to create a table in an Access mdb (remotely) on the fly. Create Table tbl1(fld1 Integer, fld2 varchar(10), fld3...) Then I have to insert data: Insert Into tbl1 Values(" &...
13
by: shankindc | last post by:
Hi, I have a data entry form which opens default values each time the form is open. Requirement is that users can edit existing data in the form. When the form is closed, it shouldnt update the...
6
by: ewpatton | last post by:
Good day, I've been trying to work with SQL and an Access database in order to handle custom user profiles. I haven't had any trouble reading from my database, but inserting new entries into...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.