andyb7901
asked on
Simple Insert Query
Hi,
Can someone tell me why my stupid database wont insert a simple query;
INSERT INTO [Gap Analysis - 02/10/2007] (1)
VALUES ("abc");
All fields are strings, a the 1 is a column heading? I get an error;
Type Conversion Error. How am I supposed to be putting in text feidls then? I have tried, ' , [ ], leaving it blank. This is the simplest query but it will not let me execute it?
Can someone tell me why my stupid database wont insert a simple query;
INSERT INTO [Gap Analysis - 02/10/2007] (1)
VALUES ("abc");
All fields are strings, a the 1 is a column heading? I get an error;
Type Conversion Error. How am I supposed to be putting in text feidls then? I have tried, ' , [ ], leaving it blank. This is the simplest query but it will not let me execute it?
Try double quote around 1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you insert numbers into a number field, no quotes at all are needed, if you insert dates into a date field it must be enclosed in # sign.
INSERT INTO TABLENAME (STRINGFIELD, DATEFIELD, NUMBERFIELD) VALUES ('abc', #12/25/2006#, 125)
MS Access is very specific...
John
INSERT INTO TABLENAME (STRINGFIELD, DATEFIELD, NUMBERFIELD) VALUES ('abc', #12/25/2006#, 125)
MS Access is very specific...
John
ASKER
I have done the following as well;
INSERT INTO [Gap Analysis] ( [And] )
VALUES ("Help");
I get to the "You are about to Append 1 Row" status screen. If I continue oast this I get the same error message again!
INSERT INTO [Gap Analysis] ( [And] )
VALUES ("Help");
I get to the "You are about to Append 1 Row" status screen. If I continue oast this I get the same error message again!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have figured it out. The required field was set to Yes on all fields. I am creating a table on the fly through VBA. Can anyone tell me how I would create the table with the requireed field set to NO on all records. My current code is;
With tbl1
.Name = GapTitle & " - " & Date
For j = 1 To NoOfControls
FieldText = Me("Text" & j)
.Columns.Append FieldText, adVarWChar, 30
Next
End With
With tbl1
.Name = GapTitle & " - " & Date
For j = 1 To NoOfControls
FieldText = Me("Text" & j)
.Columns.Append FieldText, adVarWChar, 30
Next
End With
sorry can't help with that...