[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 262
  • Last Modified:

Using a field value to reference a field name

This seems simple but I can't figure it out.  I would to use the value from Field1 to reference another field on the form.

For example.

FieldA  FieldB  FieldC

Field1 will be a combo box where you can select one of the fields above

So lets say the value for Field1 is "FieldB"

I want to basically set me.field2 = me.(value of field1 which is "FieldB")

I hope that makes sense??

0
rtmc_jneal
Asked:
rtmc_jneal
  • 4
  • 2
  • 2
2 Solutions
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:

 Me(Me.Combo)=Me.Field1

 which says - if Field2 is selected from the combo

Me("Field2") - Me.Field1

mx
0
 
mbizupCommented:
Are you trying to dynamically set the controlsource property according to what is selected in the combo?

ie: Change the field a control is bound to based on the combo selection?

You could use this in the After Update event of your combo box:


Me.YourTextboxOrWhatever.ControlSource = Me.YourCombo
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
So, when you select say FieldB from the Combo, what exactly do you want to happen ?

mx
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Maybe you mean this

Me.Field2 = Me(Me.Combo)

Which says Me.Field2 = Me("FieldB")

?

mx
0
 
rtmc_jnealAuthor Commented:
Basically I have 4 different fields that contain prices.  I'm using the value of the combo box to determine which field to pull the price from.
0
 
rtmc_jnealAuthor Commented:
DatabaseMX got it.  Thanks so much.  Figured it was simple.
0
 
mbizupCommented:
The code that I posted earlier should do the trick... what you are describing involves changing the Controlsource property of the textbox.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
You are welcome.  Wasn't quite sure what you were after.

mx
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now