Checkbox- store data in one of 2 fields

vad60

VAD60
Local time
Today, 05:16
Joined
Jul 26, 2005
Messages
28
I would like to know if I can control what field the check box enters the -1 value in my record depending on a value from another field in that record.
In my table called workbook I have fields called, phone type which is a text field, wall and wm entry which are both yes/no fields. I want to put one check box on my form to check when a wall mount is needed for the device. The thing is there are two different wall mount sizes. So I need to check the phone type field on my form, if the value is ENTRY then I need to have it enter -1 in the WM Entry field. If the field anything other than ENTRY then the -1 value should go in the WALL field.
Can this be doen and how do I code it?

Thanks in advance
 
On the form, in one of several places you could choose, put an event routine. I would do this in [PhoneType]'s AfterUpdate event, but you could do it in a LostFocus event, too.

The question, though, is whether you can override this choice, 'cause that affects whether you can lock the field against user changes or not.

Remember that for any control on a form, the default property is .Value, so you don't need to select it.

Private Sub PhoneType_AfterUpdate()

if [PhoneType] = "X" then
[WM] = TRUE
else '(this is the "anything else" case)
[WALL] = TRUE
endif

End Sub

(or something to that effect).

This assumes you can determine by inspection of its value whether your [PhoneType] condones the update of [WM] or [WALL]
 
I forgot to mention that the check box is optional for wall mount. There will be records that don't require a wall mount so the check box will not be checked and left at a 0 value.
Does this change what I need to do?
 
Doc Man thanks for the code, it worked after I figured out what I was missing. The fields I was trying to populate were not on the form. When I added them then it worked. I changed from you a check box to a text box based on a new field I added to my table. On this new field is where I added the code on the AfterUpdate. I hen created macros to Add a Wall mount and to Remove a Wall mount, in case they change their mind. I used macros so I can refresh the records so the counts I am keeping track of get updated on my sunform.
Thanks again, this forum has been a big help. I am glad I registered.
 

Users who are viewing this thread

Back
Top Bottom