getting value from table in a variable

  • Thread starter Thread starter Jack
  • Start date Start date
J

Jack

Hi,
I have one table which has a field like the following

..99999

However when I want to stored the value of the table in a variable I want
the variable to be .9999.

How can one achieve this. Thanks for any help for resolution.
 
Hi Jack

Do you mean you want to round the value to 4 decimal places?

One way to do this is to convert the value to Currency:

MyVariable = CCur( SomeValue )

Or do you want to know how to get the value from the table into a variable?

For a single field from a single record, it's easiest to use DLookup:

MyVariable = DLookup( "FieldName", "TableName", <some criteria> )

If you are fetching multiple fields or multiple records, then open a
recordset.
 
I need to have the variable rounded to four places of decimal. Thanks Graham.

Graham Mandeno said:
Hi Jack

Do you mean you want to round the value to 4 decimal places?

One way to do this is to convert the value to Currency:

MyVariable = CCur( SomeValue )

Or do you want to know how to get the value from the table into a variable?

For a single field from a single record, it's easiest to use DLookup:

MyVariable = DLookup( "FieldName", "TableName", <some criteria> )

If you are fetching multiple fields or multiple records, then open a
recordset.

--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

Jack said:
Hi,
I have one table which has a field like the following

.99999

However when I want to stored the value of the table in a variable I want
the variable to be .9999.

How can one achieve this. Thanks for any help for resolution.
 
Back
Top