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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run a query in event in access

Status
Not open for further replies.

vba317

Programmer
Joined
Mar 5, 2009
Messages
708
Location
US
I am trying to execute a query in an event in Access. I am getting an error so I was hoping I could get some help with my current statement.

Code:
Private Sub lstModelName_BeforeUpdate(Cancel As Integer)

'CurrentDb.Execute "SELECT * From TblDefectDescription", TblDefectDescription.ModelName, TblDefectDescription.Situation,TblDefectDescription.PossibleCause, TblDefectDescription.Solution1, TblDefectDescription.Solution2 WHERE (((TblDefectDescription.ModelName)=[Model Name])), dbFailOnError

End Sub
 
To clarify I am getting an complie error at the where statement
 
Anyway, CurrentDb.Execute should be used only for action queries.
As for the compile error:
Code:
"SELECT * From TblDefectDescription WHERE ModelName='" & Me![Model Name] & "'"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top