I have two tables that have a one to many relationship based on the WorkOrder fields. The main table records information on the WorkOrder and the part number table only collects part number information in the fields named "Prefix", "Body" and "Suffix". There can be multiple part numbers for each WorkOrder. I have a report that filters out only the open work orders. I am trying to take the part numbers that a apply to a specific WorkOrder and concatenate them into one text field for the report. The problem I am having is with "linking" the information on the report. I can't find any way to pull the value of the WO like you would on a form.
Private Sub Report_Open(Cancel As Integer)
Dim intWO As Integer
Dim strPN As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
intWO = Me.AlertNumber
Set db = CurrentDb
Set rs = db.OpenRecordset("qryAlertLogFinal", dbOpenDynaset)
rs.MoveFirst
strPN = ""
Do While rs!WorkOrder = intWO
If strPN = "" Then
strPN = rs!Prefix & "-" & rs!Body & "-" & rs!Suffix
Else
strPN = strPN & ", " & rs!Prefix & "-" & rs!Body & "-" & rs!Suffix
End If
rs.MoveNext
Loop
Me.PartNumbers = strPN
End Sub
John Green
Private Sub Report_Open(Cancel As Integer)
Dim intWO As Integer
Dim strPN As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
intWO = Me.AlertNumber
Set db = CurrentDb
Set rs = db.OpenRecordset("qryAlertLogFinal", dbOpenDynaset)
rs.MoveFirst
strPN = ""
Do While rs!WorkOrder = intWO
If strPN = "" Then
strPN = rs!Prefix & "-" & rs!Body & "-" & rs!Suffix
Else
strPN = strPN & ", " & rs!Prefix & "-" & rs!Body & "-" & rs!Suffix
End If
rs.MoveNext
Loop
Me.PartNumbers = strPN
End Sub
John Green