0

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

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by debasisdas
0

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...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.