Setting Variables

D

David Hunt

I am trying to set variables to a specific value found in
a table based on it's primary key.

********* begin code sample ***********

dim precut_tabs_cost as Variant

precut_tabs_cost = [charges].[unit_price] ' where [id=26]

********* end code sample ***********

I'm not getting the syntax right. Any help would be
greatly appreciated.
 
R

Rick Brandt

David Hunt said:
I am trying to set variables to a specific value found in
a table based on it's primary key.

********* begin code sample ***********

dim precut_tabs_cost as Variant

precut_tabs_cost = [charges].[unit_price] ' where [id=26]

********* end code sample ***********

There is no syntax for directly accessing a particular Field/Row in a table
like this. You need to use a DLookup function or create a Recordset.

precut_tabs_cost = DLookup("unit_price", "charges", "id=26")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top