|
-
Apr 2nd, 2005, 01:10 PM
#1
Thread Starter
New Member
cannot add record to database(Access)
Im not able to add my records to file...if file is with no records then it adds and after that do not update another records..dont understand why..
here is code:
Private Sub Command2_Click()
Dim coninvoice As Connection
Dim rinvoice As Recordset
Dim cominvoice As Command
Set coninvoice = New Connection
Set cominvoice = New Command
Set rinvoice = New Recordset
With coninvoice
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=D:\MY PROJECTS\CompInvdet.mdb;"
.Open
End With
rinvoice.CursorType = adOpenForwardOnly
rinvoice.LockType = adLockOptimistic
rinvoice.Open "select * from OutInvoices", coninvoice
If rinvoice.EOF = True Then
rinvoice.MoveLast
'rinvoice.AddNew
rinvoice!OutInvoiceNo = Text23.Text
rinvoice!InvIssuedt = Text2.Text
rinvoice!InvIssueTm = Text4.Text
rinvoice!InvRemdt = rinvoice!InvIssuedt
rinvoice!InvRemTm = Text8.Text
rinvoice!ProductName = Text10.Text
rinvoice.Update
MsgBox "added"
Else
MsgBox "notadded"
End If
coninvoice.Close
End Sub
after clicking button...its not adding and going to else part.
pleassseee help
-
Apr 2nd, 2005, 02:06 PM
#2
Lively Member
Re: cannot add record to database(Access)
Do you mean to have rinvoice.addnew commented out?
Last edited by Malim; Apr 2nd, 2005 at 09:07 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|