Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 3075

Status
Not open for further replies.

kutibo

MIS
Dec 19, 2000
22
US
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
 
So put an Error trap for 3075
Here is one I start with all the time.
------------------------
On Error GoTo Err_xxxxx 'put this at the very top under Function Blah Blah Blah

'have your code in here

Exit_xxxxx:
Exit Function 'or Exit Sub

Err_xxxxx:
Select Case Err.Number
Case 3075
' put error description here
' then make it go some where else or pop up a msgbox
msgbox Err.Description & "No Match for fldVintage and fldSize",vbInformation, "Error"
Case Else
MsgBox "Error # " & Err.Number & " " &Err.Description, vbInformation, "In sub xxxxxxx"
Resume Exit_xxxxxx
End Select

DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Hi, Kutibo!

Apparently field type(s) is/are non numeric.
Look at thread181-95511

Aivars
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top