Ref string as a field

L

Leonard

Hi

I have a DAO public module that I want other parts of the database to have
access to.

However, I need to use a variable to access a field

(ie)

Rather than use ![Actualfieldname] = "PartNumber"

I want to use a variable for the fieldname


(eg)

![("VariableForFieldName")]="PartNumber"

This is because the fieldname will change when called by different subs.

What is the syntax?

Thanks

Leonard
 
J

John Nurick

Hi Leonard,

If the recordset is rstR and the field name is in strFieldName, try

rstR.Fields(strFieldName).Value

Hi

I have a DAO public module that I want other parts of the database to have
access to.

However, I need to use a variable to access a field

(ie)

Rather than use ![Actualfieldname] = "PartNumber"

I want to use a variable for the fieldname


(eg)

![("VariableForFieldName")]="PartNumber"

This is because the fieldname will change when called by different subs.

What is the syntax?

Thanks

Leonard
 
L

Leonard

Thanks John

Much appreciated solution. Have a great 2005.

Leonard





John Nurick said:
Hi Leonard,

If the recordset is rstR and the field name is in strFieldName, try

rstR.Fields(strFieldName).Value

Hi

I have a DAO public module that I want other parts of the database to have
access to.

However, I need to use a variable to access a field

(ie)

Rather than use ![Actualfieldname] = "PartNumber"

I want to use a variable for the fieldname


(eg)

![("VariableForFieldName")]="PartNumber"

This is because the fieldname will change when called by different subs.

What is the syntax?

Thanks

Leonard
 

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