I’m doing some work on my day off and I’m having some problems with transferring data from one form to another. Currently I am getting a run-time 3061 error ‘too few parameters. Expected 1.’
I’ve had the help from mr boblarson prior in the development of this code and looking to take it a step futher.
The first form that displays the data is called ‘ReviewPurchaseOrder’ and has a command button that opens another form with the following code:
I then get the above error message. I am trying to take the current record of the ‘ReviewPurchaseOrder’ form and move to a new custom form to display the data. This form has linked criteria from what the user selects on the previous form. Currently the form pulls ALL the data from the table, not just the current record. The form also displays an error after 11 entries have been made because the ‘Do Until rst.EOF’ continues past my 10th ItemDescription.
Anyone have any suggestions on what I could do or where I could read?
Thank you.
I’ve had the help from mr boblarson prior in the development of this code and looking to take it a step futher.
The first form that displays the data is called ‘ReviewPurchaseOrder’ and has a command button that opens another form with the following code:
Code:
Option Compare Database
Private Sub btnDHS_Click()
Dim stDocName As String
stDocName = "DHS1501"
DoCmd.OpenForm stDocName
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim i As Integer
Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT * FROM tblPurchaseOrderDetails WHERE RequisitionID=" & RequisitionID)
i = 1
If rst.RecordCount > 0 Then
Do Until rst.EOF
Forms!DHS1501.Controls(i & "txtItem1") = rst("ItemDescription")
Forms!DHS1501.Controls(i & "txtItem2") = rst("StockNum")
Forms!DHS1501.Controls(i & "txtItem3") = rst("Quantity")
Forms!DHS1501.Controls(i & "txtItem4") = rst("UnitofIssue")
Forms!DHS1501.Controls(i & "txtItem5") = rst("UnitPrice")
Forms!DHS1501.Controls(i & "txtItem6") = rst("Quantity") * rst("UnitPrice")
i = i + 1
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
End Sub
I then get the above error message. I am trying to take the current record of the ‘ReviewPurchaseOrder’ form and move to a new custom form to display the data. This form has linked criteria from what the user selects on the previous form. Currently the form pulls ALL the data from the table, not just the current record. The form also displays an error after 11 entries have been made because the ‘Do Until rst.EOF’ continues past my 10th ItemDescription.
Anyone have any suggestions on what I could do or where I could read?
Thank you.