
VB6 ADO Access 97 and Data Environments
I'm having some problems with an app I'm playing around with while
learning VB.
I thought that if I used a data environment I'd be able to share data
accross the forms better, and this works really well. But how do you
add new records?
I have an Access table with VidID, VideoTitle, and DatePurchased in it
and I want to add another from a VB Form. There is also a auto-inc
field as the first column in the table called ID.
In the data environment, I have a connection which is linked to my DSN
source VideoDB, which I set up in ODBC (32 bit) in the control panel.
Next I set up a command as an object under my connection. I changed
it to a table type command with the table AllVideos. But if I do an
dataenvironment1.rscommand1.addnew I get an error saying 'invalid or
unreferenced qualifier.' Now, I'm not sure I'm doing this entirely
right...but I am going by example code in the docs. here's what I
have...
Private Sub cmdAddNewVideo_Click()
envVideoConnection.rsVideoTable.AddNew
!VidID = txtVidID.Text
!VideoTitle = txtVideoTitle.Text
!DatePurchased = txtDatePurchased.Text
End Sub
Should I be putting something in for the auto-inc field? What causes
this error to pop up? Am I calling AddNew wrong?
Thanks for any help.
<ChipOne>