Link to home
Start Free TrialLog in
Avatar of EmadGirgis
EmadGirgis

asked on

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.
Avatar of EmadGirgis
EmadGirgis

ASKER

last_update field type is data/time
try using the split function
example
??
Avatar of GrahamSkan
This will extract the strings and remove the quotes.
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

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
you can try to convert your date field to text and then compare.

MYSTRING=FORMAT(last_update ,"yyyymmdd")
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
That seems to be a completely different question, but try this

SELECT * FROM MyTable WHERE XYZField Is Null;