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

Getting a data from a table with SQL.

Status
Not open for further replies.

fernandezduk

IS-IT--Management
Jan 7, 2003
16
US
Hi,

I am getting into this again and I cannot remember the simplest things.

I have a table called data
with a field called ID

How do I get the data from that field from a Function nothing to do with a form.

I was trying docmd commands but this is not working.
I just want the simplest form of code that can do this.

Please help. Thanks guys in advance you ar the best.
 
hi

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim StrSql As String

StrSql = "SELECT [data].ID FROM [data];"
Set db = CurrentDb
Set rst = db.OpenRecordset(StrSql, dbOpenSnapshot)



Where you want to use the data put

rst.Fields("ID").Value

This will give you the result of the SQL query


Hope this helps Im not good at explaining things so any questions feel free.

Tim
 
Thanks Tim will try.


Fingers Fernandez
Helping the world be a better place!!!
HAve a nice day
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top