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

Combo Box query fails from MS Access

Status
Not open for further replies.

EdLentz

Technical User
Mar 20, 2002
85
US
I have a problem with a query from Access. Here is what I have for the Afterload event:
Dim customer As DAO.Recordset, SQLTEXT
SQLTEXT = "select * From cust where " & "[cust] = '" & Me![client] & "';"
Set customer = CurrentDb.OpenRecordset(SQLTEXT)
Me![add1] = customer![add1]
Me![add2] = customer![add2]
Me![city] = customer![city]
Me![stat] = customer![stat]
Me![rate] = customer![rate]
Me.Refresh

If my cust field has no punctuation then the query works fine. If it does then the query fails. I also cannot get a new record to enter to the table. I get the dreaded #deleted ! I have timestamp field and have done all the fixes I can find. I have another combo box on this form in a subform and it works fine.
Thanks for looking
 
add some code to the 'before update' function to add single quotes and escape other punctuation as needed

Bastien

Cat, the other other white meat
 
Thanks
That sounds like athe way to go. I a'm a noob. Can you give me a clue how to do this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top