Hi,
I need some help sending records to a variable from a button click on
my form.
I have 3 tables involved.
I need to pull out the first HEADER, then pull out that headers
DETAILS, then move to the next HEADER etc. At the end, a variable named
'specification' should hold all the records.
The HEADERS are related a PRODUCTID, and the DETAILS are related to the
HEADERS.
I keep getting 'Too Few Parameters, expected 1 ?
---------------------------
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim rst_detail As DAO.Recordset
Dim strSQL As String
Dim strSQL_detail As String
Set dbs = CurrentDb
strSQL = "SELECT specification_ID, specification_header, product_ID
FROM Specifications WHERE product_ID = " & Me.product_ID & ";"
Set rst = dbs.OpenRecordset(strSQL)
If rst.EOF Then
Exit Sub
Else
''''''' get first header ''''''
specification = "<h4>" & rst("specification_header") & "</h4>"
Do While Not rst.EOF
''''''' get first header ID''''''
detailheader = rst("specification_ID")
''''''' find DETAILS for the first HEADER ''''''
strSQL_detail = "SELECT specification_details_text, specification_ID
FROM Specification_detail WHERE specification_ID = " & detailheader &
";"
Set rst_detail = dbs.OpenRecordset(strSQL_detail)
If rst_detail.EOF Then
Else
''''''' Get Details ''''''
specification = specification & "<ul><li>" &
rst_detail("specification_detail_text") & "</li>"
Do While Not rst_detail.EOF
specification = specification & "<li>" &
rst_detail("specification_detail_text") & "</li>"
rst_detail.MoveNext
Loop
specification = specification & "</ul>"
End If
''''''' Mve to next HEADER''''''
rst.MoveNext
specification = specification & "<h4>" & rst("specification_header") &
"</h4>>"
Loop
End If
Me.product_Specs = specification
rst.Close
rst_detail.Close
dbs.Close
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.Close
--------------------------------------
This is quite compliated as there is a loop within a loop ?
Appreciate any help you can give
Thanks
David