I have a form whose record source is a table. I need to retrieve the unitcost from a query by fldVintage and fldSize and save it in the table. My code does not work when there is not match for the fldVintage and fldSize, I get error 3075. Eg.) Syntax error in string in query expression 'fldVintage = 1953 AND fldSize = 4"'.
Here is the code i have thus far thanks for your help.
Dim rst As Recordset, strsql As String
strsql = "select fldsize, fldtype, fldvintage, unitcost from qryCheckCost where fldvintage=" & Me.fldVintage & " AND fldSize = " & Me.fldSize
Set rst = CurrentDb.OpenRecordset(strsql)
getCost = rst.Fields("unitcost"
rst.Close
Kutibo
Here is the code i have thus far thanks for your help.
Dim rst As Recordset, strsql As String
strsql = "select fldsize, fldtype, fldvintage, unitcost from qryCheckCost where fldvintage=" & Me.fldVintage & " AND fldSize = " & Me.fldSize
Set rst = CurrentDb.OpenRecordset(strsql)
getCost = rst.Fields("unitcost"
rst.Close
Kutibo