Why can I not even add a blank record to this DB!
The table is created correctly:
iStmt="CREATE TABLE customers (addrid counter(1,1),recID int,fName varchar(40),lName varchar(40),"
iStmt+="street varchar(40),city varchar(40),region varchar(40),"
iStmt+="postcode varchar(9),phone varchar(40),mobile varchar(40),facebook varchar(40),"
iStmt+="work varchar(40),notes varchar(255),cphoto varchar(255),dateChanged date)"
hStmt=dbExecSQL(pDB,iStmt)
But I can't create a blank record:
iStmt="INSERT INTO customers (recID,fName,lName,street,city,region,"
iStmt+="postcode,phone,mobile,facebook,work,notes,cphoto,dateChanged) "
iStmt+="VALUES("+STR$(id)+",'new','new','','','','','','','','','','','')"
hStmt=dbExecSQL(pDB,iStmt)
temp=dbGetErrorCode(hStmt)
:P
Error 420000?
Andy.
Andy,
Are you setting id with a value? Put "INT id=1" before the SQL. Can't tell without your full code, really, what you are doing
Brian
Brian,
Did that, now I get a different error - data type mismatch.
The last field is a date field, and I'm setting it to "" - what should it be?
Thanks,
Andy.
Brian, I knocked out the date field and it works! thanks, but how do I set a blank date field?
Andy.
Easy way is to leave it out of the list and it will default to today's date, at least it should, it will probably show as blank in ACCESS. I would redo the INSERT like:
iStmt="INSERT INTO customers (recID,fName,lName) VALUES("+STR$(id)+",'new','new')"
Bill
Thanks bill,
I will bare that in mind!
Andy.