By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,068 Members | 1,210 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,068 IT Pros & Developers. It's quick & easy.

please help: run time error 3070 database does not recognize ' ' as valid field name

P: 2
Please help me.
I'm trying to update a database using code in access and the following error appears : "Run time error 3070 the microsoft access engine does not recognize ' ' as a valid field name or expression.
I'm for sure entering a valid name..
Here is my code.
Thank you!!


Expand|Select|Wrap|Line Numbers
  1. Dim db As DAO.Database
  2. Dim rs As Recordset
  3. Dim name As String
  4. Set db = CurrentDb()
  5. Set rs = db.OpenRecordset("info", dbOpenDynaset)
  6. name = InputBox(" ")
  7. rs.FindFirst "company_name = " & name  'here is the problem
  8.  
  9.  
May 30 '20 #1

✓ answered by cactusdata

Try this:

Expand|Select|Wrap|Line Numbers
  1. Dim db As DAO.Database
  2. Dim rs As DAO.Recordset
  3. Dim name As String
  4.  
  5. Set db = CurrentDb()
  6. Set rs = db.OpenRecordset("info", dbOpenDynaset)
  7.  
  8. name = InputBox("Enter Company Name")
  9. If name <> "" Then
  10.     rs.FindFirst "company_name = '" & name & "'"
  11. End If

Share this Question
Share on Google+
2 Replies


cactusdata
Expert 100+
P: 102
Try this:

Expand|Select|Wrap|Line Numbers
  1. Dim db As DAO.Database
  2. Dim rs As DAO.Recordset
  3. Dim name As String
  4.  
  5. Set db = CurrentDb()
  6. Set rs = db.OpenRecordset("info", dbOpenDynaset)
  7.  
  8. name = InputBox("Enter Company Name")
  9. If name <> "" Then
  10.     rs.FindFirst "company_name = '" & name & "'"
  11. End If
May 31 '20 #2

P: 2
Cactusdata this helped me a lot, it worked! Thank you!
May 31 '20 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Browse more Visual Basic 4 / 5 / 6 Questions on Bytes