50 pts.
 Accessing an Access DB from Outlook via VBA
Hi The situation: In Outlook I get a message from a server. The content of the message needs to be put into an Access db. But, there may not exist another message with the same date. So, I need to look into a db if there is already a message with the same date and time. If there exists one, then it needs to be replaced and otherwise the message needs to be added to the database. The database contains a list of current positions from the vehicles on the road. The problem: I have problems to compare a date time with a date time in an Access DB via VBA. The query I use returns no records but there is a record in the database. This is the query I use:   adoRS.Open "SELECT * FROM currentpositions WHERE ((currentpositions.     [dateLT])=" & "#" & date_from_message & "#" & ")", adoConn, adOpenStatic,     adLockOptimistic Second I need to now what the result is of that query.  How can I determine the number of records that my query gives me?   Thanks camastanta

Software/Hardware used:
outlook 2003, access 2003, vba ,sql
ASKED: December 15, 2009  2:23 PM
UPDATED: December 22, 2009  10:28 AM

Answer Wiki:
I am not sure if I am following your question. The Time you are referring is it the Time that Outlook puts on the message header? Or is the time included in the message as you read the Outlook message? SbElectric
Last Wiki Answer Submitted:  December 17, 2009  4:08 am  by  SbElectric   2,510 pts.
All Answer Wiki Contributors:  SbElectric   2,510 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Hi

It is the time in the message-body I use, not the time from Outlook.
This is the message-body: 10125,Road runner,16/12/2009 18:28:00,(16/12/2009 17:28:00 UTC),11,51.32400000,3.20000000, Position report. (fields: database-id, name, date local time, date utc,status, position, other)

The database: the field dateLT has format date/time with standard date-notation.

I compare the date from the message-body with the dateLT-field in the database. When there exists a record for that vehicle the record will be replaced and otherwise the content of the body is added to the database.

In fact I use more fields to compare than just the date but it is with the date I have troubles.

Regards
camastanta

 50 pts.

 

correction: when a message already exists in the db, the message will be discarted

 50 pts.

 

Hi

I am going to rephrase this in another question.

Regards
Camastanta

 50 pts.

 

Hi Camastanta,

If you wouldn’t mind, we’d rather that you keep the conversation in this question — that way users can follow your logic. If you carry your problem into a new question, some users may be missing some valuable information.

Good luck getting your answer!

Jenny
Community Manager

 4,265 pts.

 
 50 pts.