K
Keeage
I'm making a database that inputs large text files and stores the data.
I can connect to the db, display it's contents and navigate, but when
I try to add records, everything appears to function properly, but
there are no new records in the table. Could someone tell me what I'm
doing wrong?
This is the code I've written:
'define variables
lgNeighCode = 5433
stAddress = "Road to nowhere"
stTransfer = "Me to You"
intClosedPrice = 5487
Dim sql As String
Dim rsAdd As New ADODB.Recordset
On Error GoTo DbError
'Open the Recordset object
rsAdd.Open "Temp", localConnection, adOpenDynamic, _
adLockBatchOptimistic, adCmdTable
'add the record based on input from the user
'gonna use stored variables
With rsAdd
.AddNew
!NeighCode = lgNeighCode
![Full Address] = stAddress
!Transfer = stTransfer
!Closed = intClosedPrice
.Update
.Close
End With
MsgBox "Record Should be added.", vbInformation
'close form-level recordset object and refresh
'it to include the newly updated row.
rsTransfers.Close
connectDB
Exit Sub
I've been stuck at this point for several days and I would greatly
appreciate any help.
Thanks
Keeage
I can connect to the db, display it's contents and navigate, but when
I try to add records, everything appears to function properly, but
there are no new records in the table. Could someone tell me what I'm
doing wrong?
This is the code I've written:
'define variables
lgNeighCode = 5433
stAddress = "Road to nowhere"
stTransfer = "Me to You"
intClosedPrice = 5487
Dim sql As String
Dim rsAdd As New ADODB.Recordset
On Error GoTo DbError
'Open the Recordset object
rsAdd.Open "Temp", localConnection, adOpenDynamic, _
adLockBatchOptimistic, adCmdTable
'add the record based on input from the user
'gonna use stored variables
With rsAdd
.AddNew
!NeighCode = lgNeighCode
![Full Address] = stAddress
!Transfer = stTransfer
!Closed = intClosedPrice
.Update
.Close
End With
MsgBox "Record Should be added.", vbInformation
'close form-level recordset object and refresh
'it to include the newly updated row.
rsTransfers.Close
connectDB
Exit Sub
I've been stuck at this point for several days and I would greatly
appreciate any help.
Thanks
Keeage