blue021097
asked on
Strings to MS Access Database
I have 3 strings (sA, sB, sC) with some content.
I would like to know how to insert these strings in a MS Access
Database in the following manner.
Col 1 = sA
Col 2 = sB
Col 3 = sC
Do you know what I mean?
I would like to know how to insert these strings in a MS Access
Database in the following manner.
Col 1 = sA
Col 2 = sB
Col 3 = sC
Do you know what I mean?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Dude its not necessary to lock the question. If it will be the right answer he can accept your comment. If the question is locked others can't see it since most of them don't browse answered question. I beat your time though :-) i got my answer in first. Blue my example uses ADO method of access his example uses DAO you havent' specified what you were using. My method would be faster for one reason only. It uses SQL to update and it doesn't create a recordset which is a plus.
ASKER
Marine,
Your answer may very well be right but I have
accepted eab answer as it is the first
I tried out, and it worked. Problem solved.
I hope this is okay?
Your answer may very well be right but I have
accepted eab answer as it is the first
I tried out, and it worked. Problem solved.
I hope this is okay?
Dim Cn as New ADODB.Connection
Dim sCon as string,sSql as string
sCon = "Provider=Microsoft.Jet.OL
"Data Source=C:\my documents\mb.mdb;"
Cn.Open scon
Col1 = sA
Col2 = sB
Col3 = sC
sSql = "Insert Into <tablename> Values ('" & col1 & "','" & col2 & "','" & col3 & "')"
Cn.Execute sSql,adExecuteNoRecords
cn.close
Set cn = nothing
This code will insert records into 3 fields. Explain me if this is not what you looking for.