I am missing something on coding

GaryPanic

Smoke me a Kipper,Skipper
Local time
Today, 05:25
Joined
Nov 8, 2005
Messages
3,309
OK I have trimmed my coding down

I have a qry as a recordset and what I want is to add this via .addnew to MulitquoteCovertb

Private Sub mulitadding()


"stDocName = "MultisysQry"
DoCmd.OpenQuery stDocName, acNormal, acEdit"

Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("MultisysQry")
Dim MultisysQry As Recordset, MulitquoteCovertbl As Recordset
Set MultisysQry = dbs.OpenRecordset("MultisysQry")

With MultisysQry
.AddNew
!QuoteNo = Me.QuoteNo
Quotemultitbl!QuoteNo = MulitquoteCovertbl!QuoteNo
Quotemultitbl!TestTxt = MulitquoteCovertbl!TestTxt
.Update

End With

where am I going wrong ?
 
Hi,

"stDocName = "MultisysQry"
DoCmd.OpenQuery stDocName, acNormal, acEdit"

Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("MultisysQry")
Dim MultisysQry As Recordset, MulitquoteCovertbl As Recordset
Set MultisysQry = dbs.OpenRecordset("MultisysQry")

With MultisysQry
.AddNew
!QuoteNo = Me.QuoteNo
Quotemultitbl!QuoteNo = MulitquoteCovertbl!QuoteNo
Quotemultitbl!TestTxt = MulitquoteCovertbl!TestTxt
.Update

End With

I can't see the Quotemultitbl being relevant to the code.

Is this another table in your project?
 
Code:
Private Sub mulitadding()


"stDocName = "MultisysQry"                                                           'What s with the " at the start, and did you declare this?
DoCmd.OpenQuery stDocName, acNormal, acEdit"                               'Whats with the quote at the end?

Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("MultisysQry")
Dim MultisysQry As Recordset, MulitquoteCovertbl As Recordset            'Maybe it doesn't matter, but I would not use a variable with the same name that floats around in other places in your db.
Set MultisysQry = dbs.OpenRecordset("MultisysQry")                          'Is this an editable query?

With MultisysQry
.AddNew
!QuoteNo = Me.QuoteNo 
Quotemultitbl!QuoteNo = MulitquoteCovertbl!QuoteNo
Quotemultitbl!TestTxt = MulitquoteCovertbl!TestTxt
.Update

End With

'Be sure you release the recordset
'Did you forget the End Sub?
 

Users who are viewing this thread

Back
Top Bottom