Using a form to display related recordset, and filling in 2 fields from a 3rd table.<br>
DougP will recognize code he supplied to someone else for this task. Form shows a job header, and the subform shows customer job detail by unique jobno. Each customer has his bill/pay rates for each task (job detail). The SQL uses custid and task code # in the detail record, to get the bill/pay rates from BillPay table.<br>
<br>
The following code is what I am trying for the task: (yard = custid)<br>
------------<br>
Private Sub jpay_LostFocus()<br>
Dim db As Database, rst As Recordset, SQL As String<br>
Set db = CurrentDb<br>
' SQL string.<br>
SQL = "SELECT * FROM BILLPAY WHERE yard = " & Me!yard & " AND code = " & Me!code & ";"<br>
> Set rst = db.OpenRecordset(SQL)<br>
Me!jbill = rst!bill<br>
Me!jpay = rst!pay<br>
rst.Close<br>
db.Close<br>
<br>
Exit_Seek0:<br>
Exit Sub<br>
<br>
Err_Seek0:<br>
MsgBox "Update Rate Table"<br>
Resume Exit_Seek0<br>
End Sub<br>
-------------<br>
Besides a headache, I get error 3061. Too few Param-- expected (1). The > above is the offending indicator, but I suspect the problem is earlier.<br>
<br>
BILLPAY is the 1 side of a 1 to many relation<br>
<br>
Any suggestions that won't harm me?<br>
alley
DougP will recognize code he supplied to someone else for this task. Form shows a job header, and the subform shows customer job detail by unique jobno. Each customer has his bill/pay rates for each task (job detail). The SQL uses custid and task code # in the detail record, to get the bill/pay rates from BillPay table.<br>
<br>
The following code is what I am trying for the task: (yard = custid)<br>
------------<br>
Private Sub jpay_LostFocus()<br>
Dim db As Database, rst As Recordset, SQL As String<br>
Set db = CurrentDb<br>
' SQL string.<br>
SQL = "SELECT * FROM BILLPAY WHERE yard = " & Me!yard & " AND code = " & Me!code & ";"<br>
> Set rst = db.OpenRecordset(SQL)<br>
Me!jbill = rst!bill<br>
Me!jpay = rst!pay<br>
rst.Close<br>
db.Close<br>
<br>
Exit_Seek0:<br>
Exit Sub<br>
<br>
Err_Seek0:<br>
MsgBox "Update Rate Table"<br>
Resume Exit_Seek0<br>
End Sub<br>
-------------<br>
Besides a headache, I get error 3061. Too few Param-- expected (1). The > above is the offending indicator, but I suspect the problem is earlier.<br>
<br>
BILLPAY is the 1 side of a 1 to many relation<br>
<br>
Any suggestions that won't harm me?<br>
alley