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

Open recordset

Status
Not open for further replies.

BSando

Technical User
Jun 29, 2003
73
0
0
AU
Hi,
I want to call data from a table so I can manipulate the data. I am sure I need to use the openrecordset command.

I can manipulate data how I want it, but can't work out how to call the field in the table.

For example I have a table called "assetreport" and a field in the tabe is called "order #"

Any help would be appreciated

Some people make things happen, some watch while things happen, and some wonder 'What happened?'
 
This would be better in forum700. You are using Access, are you not, BSando?

Code:
Dim rs As DAO.Recordset
Set rs=CurrentDB.OpenRecordset("assetreport")

Debug.Print rs![order #]

It is best to avoid "special" characters and spaces in field names, it will save you a lot of grief.
 
Or maybe
Code:
Set rs=CurrentDB.OpenRecordset("SELECT * FROM assetreport ORDER BY [order #]")

Listen to Remou and rename the field OrderNum. The # character may be interpreted as a compiler directive, among other things you don't need. Also have a look at Reserved Words in Access VBA help.

"Don't be irreplaceable. If you can't be replaced, you can't be promoted."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top