K
Keeage
From: Keeage - view profile
Date: Sat, Dec 30 2006 7:02 pm
Email: "Keeage" <[email protected]>
Groups: microsoft.public.access.formscoding
Not yet rated
Rating:
show options
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse | Find messages by this author
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
Date: Sat, Dec 30 2006 7:02 pm
Email: "Keeage" <[email protected]>
Groups: microsoft.public.access.formscoding
Not yet rated
Rating:
show options
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse | Find messages by this author
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