[thelist] Inserting dates and booleans into MS Access

Ken Schaefer Ken at adOpenStatic.com
Wed Jan 19 17:08:54 CST 2005


Hi,

http://www.adopenstatic.com/faq/80040e14.asp <- Data Type Mismatch errors.
For Boolean fields you can use the values True/False 0/-1 etc - look in
Access Help

http://www.adopenstatic.com/faq/DateswithAccess.asp will help with inserting
dates into Access. NOTE: Access just *displays* dates according to regional
formatting settings etc. Dates are stored internally as integers (eg number
of days before or after some arbitrary starting date). This is how pretty
much every DBMS works. When you pass in a date as a string, it needs to be in
a parsable format that the DBMS can understand

As for constructing SQL statements and delimiters - just remember that you
are passing the string to the database to run. Access (or more exactly Jet)
runs the SQL statement, not PHP (or ASP or whatever). The string needs to be
formatted just right so that the DBMS can parse it and work out what to do
with it. Boolean fields have no delimiters. The statement needs to look like;

UPDATE myTable SET myBooleanField = True



Cheers
Ken

: -----Original Message-----
: From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On
: Behalf Of Tim Burgan
: Sent: Thursday, 20 January 2005 12:57 AM
: To: thelist at lists.evolt.org
: Subject: Re: [thelist] Inserting dates and booleans into MS Access
: 
: Jay Blanchard wrote:
: 
: > Now, what about the checkboxes?
: 
: 
: Yeah.. I got a little over-excited!
: 
: Still got these to worry about.
: 
: 
: I tried converting the boolean values of the variables I'm using to
: strings, so that instead of the SQL looking like:
: 
:    INSERT INTO tblStudents
:     (name, username, password, permissions, website, displayUser)
:    VALUES ('jon','dfg','gdfd','20-Jan-05','student','0','1');
: 
: it looks like:
: 
:    INSERT INTO tblStudents
:     (name, username, password, permissions, website, displayUser)
:    VALUES ('jon','dfg','gdfd','student','False','True');
: 
: This didn't work either. The format setting in Access is set to
: True/False, not Yes/No or On/Off.
: 
: 
: Any suggestions?. it seems that PHP must ALWAYS contain the single
: quotes with each value to obtain correct syntax.
: 
: 
: Thanks again
: Tim
: 
: 
: 
: --
: 
: * * Please support the community that supports you.  * *
: http://evolt.org/help_support_evolt/
: 
: For unsubscribe and other options, including the Tip Harvester
: and archives of thelist go to: http://lists.evolt.org
: Workers of the Web, evolt !


More information about the thelist mailing list