Lookout

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I send datamember points to an ".mdb" MS Access file?

Mike,
I'm attempting to insert a the date in mm/dd/yyyy format in the first column.  I've been told the TODAY() and NOW() will only provide a numerical value.  I think an option is inserting one text that includes 3 pots.  One pot for the month, one for the day, one for the year.  Between each pot use a /.  However I'm not sure what the proper syntax is when I enter it in the SQLExec object expression.    The pots will be assigned the system values (i.e PC date)

 

I appreciate your help

 

Thank you,

Hank

 

 

 

0 Kudos
Message 11 of 19
(4,466 Views)

Here is what you need to get there:  http://zone.ni.com/devzone/cda/epd/p/id/1400

 

That is an example of splitting the month, day, year, hour, minute and seconds into seperate objects.

 

Also, Access date format is inserted between #.  #03/25/2009 13:34:54#

 

Mike

Mike Crabtree - Lead Developer
Destek of Nevada, Inc. / Digital Telemetry Systems, Inc.
(866) 964-6948 / (760) 247-9512
0 Kudos
Message 12 of 19
(4,460 Views)

Mike,

I have got the SQLExec expression to work - no syntax errors.  I created MDB table and defined the fields in access.  However when I execute the expression it gives me an error on the Alarms Window in the ODBC area: [Not Buffered] 2300/-1053: [Microsoft][ODBC Microsoft Access Driver] Index or primary key cannnot contain Null value..

 

Hank

 

 

0 Kudos
Message 13 of 19
(4,427 Views)
post your sql syntax, with values is fine. 
Mike Crabtree - Lead Developer
Destek of Nevada, Inc. / Digital Telemetry Systems, Inc.
(866) 964-6948 / (760) 247-9512
0 Kudos
Message 14 of 19
(4,425 Views)

Below is the sytnax used to send data to the table H13_Daily_Totals.  The corresponding fields'  datatype is a  number (field size=long integer)

The process name is "MAIN"

 

SQLExec expression: "INSERT INTO H13_DAILY_TOTALS (CHEM_TOTALS, WEIGHT_TOTALS, WATER_TOTALS, DEL_TOTALS, RATIO, TEMP_AVG, CONVEYOR_RUN, CONVEYOR_OFF, CONVEYOR_STOPS) VALUES ("&\\.\MAIN\DL1.H1_CHEM_TOTAL&", "&\\.\MAIN\DL1.H1_WEIGHT_TOTAL&", "&\\.\MAIN\DL1.H1_WATER_TOTAL&", "&\\.\MAIN\DL1.H1_DEL&", "&\\.\MAIN\DL1.H1_RATIO&", "&\\.\MAIN\DL1.H1_TEMP_AVERAGE&", "&\\.\MAIN\DL0.CONVEYOR_RUNTIME&", "&\\.\MAIN\DL0.CONVEYOR_OFFTIME&", "&\\.\HOUSE1\DL1.H1_CONV_STOPS&")"

 

 

0 Kudos
Message 15 of 19
(4,423 Views)

What field is the primary key?

 

Id suggest a seperate column simply called  rowIndex as an autonumber

 

mike

Message Edited by Mike@DTSI on 03-30-2009 03:59 PM
Mike Crabtree - Lead Developer
Destek of Nevada, Inc. / Digital Telemetry Systems, Inc.
(866) 964-6948 / (760) 247-9512
0 Kudos
Message 16 of 19
(4,420 Views)

When I originally created the table, I did not select a field as the primary key.  Does the field "RowIndex" need to be the first column? How does the autonumber data type function?

0 Kudos
Message 17 of 19
(4,415 Views)

It can be any column over, first, middle, last.

 

Simply create a new column and set the field as an autonumber.  Then set as the primary key.

 

Mike

Mike Crabtree - Lead Developer
Destek of Nevada, Inc. / Digital Telemetry Systems, Inc.
(866) 964-6948 / (760) 247-9512
0 Kudos
Message 18 of 19
(4,412 Views)

The error is gone, but no values were inserted in the fields.  Just "0"  I re-executed the command and did not create an extra row of values.

0 Kudos
Message 19 of 19
(4,410 Views)