Subform only shows single record

daleowens1949

New member
Local time
Today, 01:52
Joined
Dec 14, 2024
Messages
2
The user first selects the job number from job number combo (packing slip maker for a machine shop). Then selects the line number for the items being shipped from line number combo. I create a new record on the table the subform uses. My problem: No matter how many line numbers I add to the subform table only a single line shows up. Code below.

Private Sub cboLineNumber_AfterUpdate()
Dim rsShipLableDetail As Recordset
Dim sLineNum As String
Dim iPos As Integer

On Local Error GoTo ERR_cboLineNumber_AfterUpdate

sLineNum = cboLineNumber
If RNLen(msLineNumList) = 0 Then GoTo ADD_LINE ' msLineNumList empty
iPos = InStr(1, msLineNumList, sLineNum) ' msLineNumList has line numbers - Don't duplicate
If iPos = 0 Then GoTo ADD_LINE ' Selected line number not added yet

EXIT_cboLineNumber_AfterUpdate:
Exit Sub
ERR_cboLineNumber_AfterUpdate:
Debug.Print Err, Err.Description
ShowError "frmMakeShippingLabel_cboLineNumber_AfterUpdate"
Resume EXIT_cboLineNumber_AfterUpdate

ADD_LINE:
' Add line number to linenumber list - this code does not work
'msLineNumList = msLineNumList & sLineNum & ";"
'Forms!frmMakeShippingLabel.fsubOrderPackingSlip.SetFocus
'With Forms!frmMakeShippingLabel!fsubOrderPackingSlip.SetFocus
' RunCommand acCmdRecordsGoToNew
' !LableJobNumber = Me.cboJobNumber
' !LableLineNumbere = Me.cboLineNumber
' !LableOrdered = Me.cboLineNumber.Column(1)
' !LableSold = Me.cboLineNumber.Column(2)
' !LableDue = Me.cboLineNumber.Column(3)
' !LableItemNumber = Me.cboLineNumber.Column(4)
' !LableDescription = Me.cboLineNumber.Column(5)
' !LableShiped = Me.cboLineNumber.Column(6)
' saving should not really be necessary, but...
' RunCommand acCmdSaveRecord
'End With

'shows only the first record saved to the table
Set rsShipLableDetail = CurrentDb.OpenRecordset("tblLabelDetail", dbOpenDynaset)
rsShipLableDetail.AddNew
rsShipLableDetail("LableJobNumber") = Me.cboJobNumber
rsShipLableDetail("LableLineNumber") = Me.cboLineNumber
rsShipLableDetail("LableOrdered") = Me.cboLineNumber.Column(1)
rsShipLableDetail("LableSold") = Me.cboLineNumber.Column(2)
rsShipLableDetail("LableDue") = Me.cboLineNumber.Column(3)
rsShipLableDetail("LableItemNumber") = Me.cboLineNumber.Column(4)
rsShipLableDetail("LableDescription") = Me.cboLineNumber.Column(5)
rsShipLableDetail("LableShiped") = Me.cboLineNumber.Column(6)
rsShipLableDetail.Update
rsShipLableDetail.Close
Set rsShipLableDetail = Nothing
Forms![frmMakeShippingLabel]![fsubOrderPackingSlip].Requery

End Sub
 
Welcome to Access World! We're so happy to have you join us as a member of our community. As the most active Microsoft Access discussion forum on the internet, with posts dating back more than 20 years, we have a wealth of knowledge and experience to share with you.

We're a friendly and helpful community, so don't hesitate to ask any questions you have or share your own experiences with Access. We're here to support you and help you get the most out of this powerful database program.

To get started, we recommend reading the post linked below. It contains important information for all new users of the forum:

https://www.access-programmers.co.uk/forums/threads/new-member-read-me-first.223250/

We hope you have a great time participating in the discussion and learning from other Access enthusiasts. We look forward to having you around!
 
Why in the Introduce Yourself sub forum?
Also why are you not using bound forms instead of recordsets? :(

Never see this in VBA?
On Local Error ???
 
No matter how many line numbers I add to the subform table only a single line shows up. Code below.
maybe check the Master/Child Link fields property of the subform.
 

Users who are viewing this thread

Back
Top Bottom