Setting Value based on toggle Button

brendandaly

Registered User.
Local time
Yesterday, 22:43
Joined
Apr 29, 2011
Messages
36
Hey all,

I'm trying to figure out the code to be able have access fill out a field (lets call it field a) with the contents of field b, c, or d when I click on a toggle button next to b, c, or d. I know this seems pretty simple but I've exhausted my knowledge on how to do this and have no where else to turn. Thanks!
 
If these are three individual toggle buttons placed on a form, then you would use the Click event of each toggle button to do something like the following;

Code:
Private Sub btnToggle1_Click()
 
Me!FieldA = Me!FieldB
 
End Sub
 
Private Sub btnToggle2_Click()
 
Me!FieldA = Me!FieldC
 
End Sub

If the toggle buttons are part of an Option Group, then you would use the After Update event of the Option Group;

Code:
Private Sub ogpMyGroup_AfterUpdate()
 
Select Case Me!ogpMyGroup
    Case 1
        Me!FieldA = Me!FieldB
    Case 2
        Me!FieldA = Me!FieldC
    Case 3
        Me!FieldA = Me!FieldD
End Select
 
End Sub
 
Thats great. Thank you so much! I actually tried to do both of these and thought that they would work but was using period instead of exclamation marks. I guess thats pretty clear evidence of my novice status with VBA.... But again, thanks a lot man...
 
The real question here is 'why would you want to do this?'

Storing the same piece of data in two places in an entire database is usually a sign of poor design. Doing it in a single record is almost sure to be!

Linq ;0)>
 
Oh I agree. The problem is that the users are using a form that works on two numbers, that represent profiles, at the same time, combining them if need be. However, I need my database to output to another database that only stores records one at a time (one record for the number combined into, another for the one now empty) and I need a good way of differentiating the two numbers before the transfer.
In addition, this is database needs to fill a client-provided table which includes a "winning profile" column.
If you have any suggestions on what I could do to solve that first issue I am all ears for sure...
 

Users who are viewing this thread

Back
Top Bottom