I am trying to fill an unbound text box on a report. The Code field in my Stock table is text as I am using alphanumeric codes. I am using the following function
Function FillRep()
Dim rs As Recordset
Dim db As Database
Set db = CurrentDb
Set rs = db.OpenRecordset("STOCK", dbOpenDynaset)
rs.MoveFirst
rs.FindFirst "[P_NO] =" & "'Reports![Fill Report]![P_NO]'"
Reports![Fill Report]![Price] = rs![PRICE_1]
'FillRep = rs![P_NO]
End Function
The problem I have is that I only get the same value in every line of the [Price] text box which is the first record in the Stock table. I can get it to work If I change my text field to numeric and use rs.FindFirst "[P_NO] =" & Reports![Fill Report]![P_NO] but alas I am unable to use a text field in my Stock table because of some stock code constraints
Function FillRep()
Dim rs As Recordset
Dim db As Database
Set db = CurrentDb
Set rs = db.OpenRecordset("STOCK", dbOpenDynaset)
rs.MoveFirst
rs.FindFirst "[P_NO] =" & "'Reports![Fill Report]![P_NO]'"
Reports![Fill Report]![Price] = rs![PRICE_1]
'FillRep = rs![P_NO]
End Function
The problem I have is that I only get the same value in every line of the [Price] text box which is the first record in the Stock table. I can get it to work If I change my text field to numeric and use rs.FindFirst "[P_NO] =" & Reports![Fill Report]![P_NO] but alas I am unable to use a text field in my Stock table because of some stock code constraints