Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time Error 3246

Status
Not open for further replies.

kopy

Technical User
May 30, 2002
141
US
I have a form, used to create and document quotes for parts, that has the AllowEdits property set to No so that once a quote is written it can not be changed.

If the user moves to a new record, I want to change the AllowEdits property to Yes. There is a combo box that the user can use to base the new quote on an existing part number.

I've tried placing Me.AllowEdits= True in several places to mkae the form editable. I keep getting Error 3426 on this line of code: rst1.AddNew

Here is my code:

Private Sub cboLookUpPart_AfterUpdate()

'Map Part's Current Descriptive Data to Quote
'--------------------------------------------
Me.txtPartNumber = Me.cboLookUpPart.Column(0)
Me.txtPartName = Me.cboLookUpPart.Column(1)
Me.txtREV = Me.cboLookUpPart.Column(2)
Me.cboMaterial = Me.cboLookUpPart.Column(3)
Me.cboShape = Me.cboLookUpPart.Column(4)
Me.txtDimensions = Me.cboLookUpPart.Column(5)
Me.txtLenPiece = Me.cboLookUpPart.Column(6)

Me.Refresh

'Map Part's Current Routing to Quote
'-----------------------------------
Dim rst As DAO.Recordset, sfrm As Form, sfrm1 As Form

Set sfrm = Forms![frmQuotes]![subUnionOperations].Form
Set rst = sfrm.RecordsetClone

Set sfrm1 = Forms![frmQuotes]![tblQuoteOps subform].Form
Set rst1 = sfrm1.Recordset

If rst.RecordCount >= 1 Then
rst.MoveFirst
Else
Exit Sub
End If

Do

Me![tblQuoteOps subform].Form![txtQuoteID] = Me![txtQuoteID]
Me![tblQuoteOps subform].Form![txtOperationNumber] = rst![Operation#]
Me![tblQuoteOps subform].Form![txtType] = rst![Type]
Me![tblQuoteOps subform].Form![cboDesc] = rst![Machine]
Me![tblQuoteOps subform].Form![txtSetUpTime] = rst![SetUpTime]
Me![tblQuoteOps subform].Form![txtRunTime] = rst![RunTime]

rst.MoveNext

rst1.AddNew
rst1.Update

Loop Until rst.EOF

End Sub

Any help will be greatly appeciated,

Kopy
 
try
on form current

me.allowedits = me.newreord
 
Thanks for the help.

I placed it at the end of on current event, but still get the error. Any suggestion of a better place? Here's my code:

Private Sub Form_Current()
'Display New QuoteID for a New Record
'--------------------------------------
Dim intnewrec As Integer

Set frm = Form
intnewrec = frm.NewRecord

If intnewrec = True Then

Me.[txtQuoteID].Value = DLookup("[NewQuoteID]", "qryCalculateNextQuoteID")

'Append New QuoteID to Related Tables
'--------------------------------------
Dim stDocName As String

DoCmd.SetWarnings False

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

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

DoCmd.SetWarnings True

'Display Part Combo Box for New Record
'-------------------------------------
Me.cboLookUpPart.Visible = True

ElseIf intnewrec = False Then

Me.cboLookUpPart.Visible = False

Exit Sub

End If

Me.Refresh

Me.AllowEdits = Me.NewRecord

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top