Morning everyone
I have a basic (pun intended?) question. I have a form ("Form1") which is not bound to any underlying table. On the form are 5 Option buttons ("Option1"..."Option 5"). I've been trying to figure out the code to write a new record to an existing table ("Table1") depending on which of the 5 option buttons are clicked but am getting nowhere fast (eg. clicking Option1 button would add a new record "Blue" to Table1 whereas clicking Option2 button would add a new record "Green" to Table1 etc.). To complicate matters, if I subsequently deselect Option1 button I would like the corresponding record from Table1 (in this example, "Blue") deleted. Maybe I'm asking for something that's programmatically difficult or it's actually quite simple and I'm overthinking it. I'll admit my VBA knowledge is mainly based on copying code from other sources and adapting it for my particular needs. My brain's fried so any help would be much appreciated.
Just thinking...instead of writing a new record each time one of the Option buttons is selected, it might be better (easier?) to have a procedure that executes once the form is completed, loops through the 5 Option buttons and only writes a record for each one that is selected (or "True").
TIA
DDJ
I have a basic (pun intended?) question. I have a form ("Form1") which is not bound to any underlying table. On the form are 5 Option buttons ("Option1"..."Option 5"). I've been trying to figure out the code to write a new record to an existing table ("Table1") depending on which of the 5 option buttons are clicked but am getting nowhere fast (eg. clicking Option1 button would add a new record "Blue" to Table1 whereas clicking Option2 button would add a new record "Green" to Table1 etc.). To complicate matters, if I subsequently deselect Option1 button I would like the corresponding record from Table1 (in this example, "Blue") deleted. Maybe I'm asking for something that's programmatically difficult or it's actually quite simple and I'm overthinking it. I'll admit my VBA knowledge is mainly based on copying code from other sources and adapting it for my particular needs. My brain's fried so any help would be much appreciated.
Just thinking...instead of writing a new record each time one of the Option buttons is selected, it might be better (easier?) to have a procedure that executes once the form is completed, loops through the 5 Option buttons and only writes a record for each one that is selected (or "True").
TIA
DDJ
Last edited: