accessing 1 field in a access table

i used a sql command in Access vba code to add a record into a table ie INSERT INTO Results '  .  now i want to read another table that has 1 field in it and if it is a number add one to it and save it again .  if it is not a number then do not do anything with it.

your thoughts?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
This is simple to perform with VBA and DAO:

Dim rs As DAO.Recordset

Set rs = CurrentDb.OpenRecordset("Select YourField From YourTable")
' or, if some criteria:
' Set rs = CurrentDb.OpenRecordset("Select YourField From YourTable Where SomeField = " & SomeNumericValue & "")
' Set rs = CurrentDb.OpenRecordset("Select YourField From YourTable Where SomeField = '" & SomeTextValue & "'")
If IsNumeric(rs!Fields(0).Value) Then
        rs.Fields(0).Value = Val(rs.Fields(0).Value) + 1
        ' or, if the field's data type is Text:
        ' rs.Fields(0).Value = LTrim(Str(Val(rs.Fields(0).Value) + 1))
End If

Open in new window

You can also do this with just a simple update statement.
dbEngine(0)(0).Execute("Update OneRowTable Set SomeField=SomeField+1 Where IsNumeric(SomeField)=True")

Open in new window

rjefAuthor Commented:
what if the table is linked?
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Gustav BrockCIOCommented:
It makes no difference.
rjefAuthor Commented:
i get an error says something about unable to update linked file using isam
Gustav BrockCIOCommented:
You can only update linked Access or ODBC tables.
Linked Text files and Excel worksheets are not updatable directly; that takes some more code.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.