I start programming in Vb6 a few weeks ago, and I have a big problem now…
When I like to insert Date in .dbf table from my VB6 Application, I get the error:

Malformed GUID. In query expression

My SQL string:
strSQL = "INSERT INTO stok_sme (Date_time) VALUES ({^" & Format(datdw, "yyyy-mm-dd") & "})"

If I try this string (with Values, normally) in Visual FoxPro, everything works fine. But if I try this from Vb6 Application, I get the ERROR…
I’m thinking that I have problem with the {^….}…..

Can somebody help me?

Recommended Answers

All 3 Replies


strSQL = "INSERT INTO stok_sme (Date_time) VALUES ({^" & Format(datdw, "yyyy-mm-dd") & "})"


strSQL = "INSERT INTO stok_sme (Date_time) VALUES (#" & Format(datdw, "yyyy-mm-dd") & "#)"

how about date plus clock format?
strSQL1 = "insert into stok_sme values ('" & Format(TGLMASUK, "dd-mmm-yyyy hh:mm:ss") & "')"
i have eeror... pls help me

In vb it is the syntax to write the DateTime value you must be prefixed and sufixed the value by Hash Character i.e. #.

Dim CurDateTime As Date
CurDateTime = #1/16/2015 9:15:30 AM#

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.