General discussion

Locked

using VB to export information

I am testing out VB trying to get it to export the contents of text boxes out to a Access 2000 database. I have code to view the records but I can't seem to get the save button to save a record change or save a newly added record. Here is the codeI am using.
Private Sub cmdsave_Click()
With rsproducts
If baddnew Then .AddNew
rsproducts!firstname = Text1.Text
rsproducts!lastname = Text2.Text
rsproducts!city = Text3.Text
rsproducts.Update
End With
End Sub
I have established an open connection and can see information but can't seem to save any changes. I have the ADO 2.5 library and
microsoft access 9 library as well

any suggestions??

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

using VB to export information

by Shanghai Sam In reply to using VB to export inform ...

My guess is you have your ADO Recordset set up wrong. Try this

'Put this code where you create your Rs
With RsADO
.CursorLocation = adUseClient

.Open "SELECT F1,F2 FROM TBL_1", _
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\SomeDB.mdb", _
adOpenDynamic, adLockOptimistic

End With

Private Sub cmdSave_Click()
With RsAdo
'I assume baddnew is a public boolean
'variable
'I also assume that when your calling this
'for an update you have your Rs pointer
'at the correct record
If baddNew Then .AddNew
!F1 = CStr(Txt1.Text)
!F2 = CStr(Txt2.Text)
.Update
End With
End Sub

If you need another example let me know.
Good Luck
Neal Martinelli

Collapse -

using VB to export information

It helped but I am still stuck

Collapse -

using VB to export information

by roc180 In reply to using VB to export inform ...
Collapse -

using VB to export information

Poster rated this answer

Collapse -

using VB to export information

This question was closed by the author

Back to Software Forum
5 total posts (Page 1 of 1)  

Software Forums