parse as a string remove the double quotes too

"Generated","04-25-2010","at","08:40:13pm"

In MS Access 2003.... Visual Basic 6.
I need to extract the value 04-25-2010 in str1
I need to extract the value 08:40:13pm in str2

Now I need to combine both and compare to a field last_update from  a table called cntrl
if the value is different, I need to update the table with this value.
EmadGirgisAsked:
Who is Participating?
 
GrahamSkanRetiredCommented:
It is best to compare dates directly. You can convert the strings to a date type by using CDate.


dim MyDate as Date

MyDate = Cdate(str1 & " " & str2)
0
 
EmadGirgisAuthor Commented:
last_update field type is data/time
0
 
Sarika30Commented:
try using the split function
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
EmadGirgisAuthor Commented:
example
??
0
 
GrahamSkanRetiredCommented:
This will extract the strings and remove the quotes.
0
 
GrahamSkanRetiredCommented:
Oops. It works better if I remember to post the code.
    Dim str1 As String
    Dim str2 As String
    Dim strParts() As String
    Const MyString = """Generated"",""04-25-2010"",""at"",""08:40:13pm"""
    
    strParts = Split(MyString, ",")
    str1 = Replace(strParts(1), """", "")
    str2 = Replace(strParts(3), """", "")

Open in new window

0
 
EmadGirgisAuthor Commented:
Cool

I have a question...
How I combine sr1 and str2 and use it against date/time field in my database
is there a To_DATE function or something like oracle
0
 
Sarika30Commented:
you can try to convert your date field to text and then compare.

MYSTRING=FORMAT(last_update ,"yyyymmdd")
0
 
EmadGirgisAuthor Commented:
GrahamSkan,

There is a table I populate from a csv file. Some field get empty.

How to represent the empty in a where clause.

PSEUDO CODE

WHERE XYZField is empty
0
 
GrahamSkanRetiredCommented:
That seems to be a completely different question, but try this

SELECT * FROM MyTable WHERE XYZField Is Null;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.