0
votes

I am creating a new database that will store test requests that people input through a request form. On my data input form, I have a "field name" section where the requestor will input the name of the football field that they want tested. If I put letters/words in the field and try to record the data to the table, it gives me "Run-time error '3075': Syntax error (missing operator) in query expression." However, if I put a number, such as 1 or 2, it will record with no problem. Requestors will be inputting sports field names when they go to input a request. I am fairly new to VBA and access, so any help or suggestions would be greatly appreciated.

Private Sub cmdSavereuserequest_Click()
    'add data to table
    CurrentDb.Execute "INSERT INTO ReuseTestRequests(Location, RequestDate, DueDate, Requestor, InfillSystem, FiberType, OldFieldArea, NewFieldArea, AvgInfillDepth, Comments) " & " VALUES(" & Me.txtField & ",'" & Me.txtRequestdate & "','" & Me.txtDuedate & "','" & Me.txtRequestor & "','" & Me.txtInfillsystem & "','" & Me.txtFibertype & "','" & Me.txtOldfieldarea & "','" & Me.txtNewfieldarea & "','" & Me.txtAvginfilldepth & "','" & Me.txtComments & "')"
End sub
1

1 Answers

0
votes

Date values must be formatted and wrapped in octothorpes:

... ",#" & Format(Me.txtRequestdate, "yyyy\/mm\/dd") & "#, ...