hi all!
I'm usuing VB 5.0. I need to store data getting input in VBform in MSAccess data base.
I tried with ADO connection but its not working.

Can any one send me the basic code to store data in MSaccess and to read the data.

You help is highly appreciated.

thanks

Depends, you only need to store data?

stringquery = "INSERT INTO user SET name = '" & name.Value& "';"

Then you can just use DoCmd.RunSQL(stringQuery)

Or dou you want to extract data from the database?

in that case:

Dim Conn As ADODB.Connection
Dim rs As New ADODB.Recordset

Set Conn = CurrentProject.Connection
Set rs = New ADODB.Recordset

queryString = "SELECT * FROM user WHERE userid = " & userid.Value & ";"

rs.Open queryString, Conn, adOpenKeyset, adLockOptimistic

Do Until rs.EOF
name = rs(0)
rs.MoveNext
Loop

hopes it helps...

to store data in database you need to use Insert query from frontend not select .

Be a part of the DaniWeb community

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