Set Variable = Field Value 
Author Message
 Set Variable = Field Value

I want to set a variable to be equal to a record ID number so that I can
retrieve it in a different form.  This is a piece of my code, when I debug,
I can see the correct value of the RecordID, but it's value does not get
assigned to my lngRecEdit variable.  Do you know what I am doing wrong?
Thanks!

Static lngRecEdit as Variant
Set db = CurrentDb()
Set rec = db.OpenRecordset(strSQL)

lngRecEdit = rec![RecordID].Value



Wed, 11 Sep 2002 03:00:00 GMT  
 Set Variable = Field Value
Take the .Value off
Assuming the name of the text box is RecordID, you do not need the .Value
parameter to store the value in a variable.



Quote:
> I want to set a variable to be equal to a record ID number so that I can
> retrieve it in a different form.  This is a piece of my code, when I
debug,
> I can see the correct value of the RecordID, but it's value does not get
> assigned to my lngRecEdit variable.  Do you know what I am doing wrong?
> Thanks!

> Static lngRecEdit as Variant
> Set db = CurrentDb()
> Set rec = db.OpenRecordset(strSQL)

> lngRecEdit = rec![RecordID].Value



Wed, 11 Sep 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Selecting Field Values with a VARIABLE field name

2. Setting a variable to the largest record value.

3. Setting Bookmark to Variable value

4. Create an AutoTextEntry with it's value set to a document variable

5. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value

6. Set many "values" to variables

7. How do I set a static variable value?

8. Set a text file as variable value

9. Setting the value of a server variable from a client script

10. Setting variable values

11. How to set a null value for a data variable

12. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value

 

 
Powered by phpBB® Forum Software