Assign variable a value in a table with vba, acc97 
Author Message
 Assign variable a value in a table with vba, acc97

Hi,

How do I assign a variable in a vb function a specific value in a table
in Access 97?

The table has these values: Id#, Element, Atomic%

the VB code provides the Id# and the Element. I need to set the variable
= to the Atomic% so that I can perform calculations on it.

Thank you,

Mike



Sun, 28 Apr 2002 03:00:00 GMT  
 Assign variable a value in a table with vba, acc97
MyVariable=DLookup("[Atomic%]", "TableName", _
  "[Id#]=" & TheID & " And [Element] = """ & _
  TheElement & """")

This syntax assumes that ID# is numeric and Element is text. Using a
recordset would be faster than using DLookup if there is a lot of
data, but in your case DLookup is probably fine.

 -- Andy

Quote:

>Hi,

>How do I assign a variable in a vb function a specific value in a table
>in Access 97?

>The table has these values: Id#, Element, Atomic%

>the VB code provides the Id# and the Element. I need to set the variable
>= to the Atomic% so that I can perform calculations on it.

>Thank you,

>Mike



Sun, 28 Apr 2002 03:00:00 GMT  
 Assign variable a value in a table with vba, acc97
Thank you Andy! I'll give it a shot.

Mike

Quote:

> MyVariable=DLookup("[Atomic%]", "TableName", _
>   "[Id#]=" & TheID & " And [Element] = """ & _
>   TheElement & """")

> This syntax assumes that ID# is numeric and Element is text. Using a
> recordset would be faster than using DLookup if there is a lot of
> data, but in your case DLookup is probably fine.

>  -- Andy


> >Hi,

> >How do I assign a variable in a vb function a specific value in a table
> >in Access 97?

> >The table has these values: Id#, Element, Atomic%

> >the VB code provides the Id# and the Element. I need to set the variable
> >= to the Atomic% so that I can perform calculations on it.

> >Thank you,

> >Mike

--
Visit the Randall's home page at: http://www.gci-net.com/users/m/mikerand


Sun, 28 Apr 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Assigning the value of a variable to a control in Vba

2. VBA: assign a value from file to a variable

3. Copy Record from Table 1 to Table 2 - Acc97 - VBA

4. Assigning the value to the value of a variable

5. ACC97: Global variables dropping values intermittently

6. Assign a value to a variable using Select

7. ACC 97: Assign values to variables

8. Decimal precision when assigning values to variables

9. CAN'T ASSIGN A NULL VALUE TO A VARIABLE

10. Assigning a value from a list box to a variable

11. Assigning value to textbox if textbox is a variable name

12. Assigning values in Access using a variable

 

 
Powered by phpBB® Forum Software