update table based on radio buttons

jenkins

New member
Local time
Today, 06:56
Joined
Sep 23, 2010
Messages
5
Hello I have a form with 10 radio buttons on.
They are
A1 A2 A3 A4
B1 B2 B3 B4
the represent the locations that an item can be placed.
The user can choose any of them and basied on how many they choose it depends on how many locations the item is in. Each location needs to entered into the table as a seperate entry. i.e if they choose them all one for A1, A2, A3, A4, B1, B2, B3, B4. I have the form submitting button working for the part feild but how do I update the table based on the radio buttons selected?
Is it also possible that when A1 is selected then the location coloum would read A1?

If any more information is needed please tell me, thanks in advanced.
 
Do these locations correspond to values in a Locations table? I would be inclined to use a multiselect listbox because your list of locations may change (in the future).

You would need to iterate through your list of locations and run your INSERT/UPDATE action for each control.
 
Do these locations correspond to values in a Locations table? I would be inclined to use a multiselect listbox because your list of locations may change (in the future).

You would need to iterate through your list of locations and run your INSERT/UPDATE action for each control.

I would like each radio button to put the value into the location coloum. If A1 was selected the location coloum would read A1 .

The list of locations will not change in the for see able future

How do I do an insert/update action for each location that is selected? The purpose of being able to select multiple locations is so that the user does not have to put the same data in several times.
 
sounds strange to be honest

how do you control how many buttons they can click

ie
- if they have one item, how can it be in two places at once
- if they have more than one item, how do you control how many are stored in each location.

--------------
 
sounds strange to be honest

how do you control how many buttons they can click

ie
- if they have one item, how can it be in two places at once
- if they have more than one item, how do you control how many are stored in each location.

--------------

There can be more than one item, only one can go in each location. The logic behind the radio buttons does work in this situation.
 
Hello I have a form with 10 radio buttons on.
They are
A1 A2 A3 A4
B1 B2 B3 B4

10? I count 8. :)

From someone with 14 years of Access database experience. Don't use radio buttons for the locations. They are bound to change at some point, whether it is 2 months or 2 years down the line, something will need to be added or removed.

Design your database with the ultimate in flexibility and reusability in mind. Things like this need something that allows you to add an area just by adding a record to a table.

But, I know that my words are probably going to go unheeded as it is quite like the teenagers with their parents. They have something in mind and feel their parents just don't understand their situation. :D
 
From someone with 14 years of Access database experience. Don't use radio buttons for the locations. They are bound to change at some point, whether it is 2 months or 2 years down the line, something will need to be added or removed.
Quite right Bob. First thing I mentioned in my first post.
 
If you absolutly must use radio buttons then the answer would depend on how you want the data saved.

You mention you want A1 in the location column if the user selects A1. If they also select A2 do you expect A1,A2 to be in the location column or would you expect a separate row for each?

Either way you will have to check the value of each radio button when the user clicks the submit button.

If you want multiple values in one row then build a string based on the vales, eg A1 = true strLocation = "A1" A2 = true strLocation = strLocation & ",A2" and so on. Then save the record with the string in the location column.

If you want single rows then for each radio buton you find to be true then save a record with the location being what ever radio button you just checked.

This is not a great way to do it as you would be hard coding most of it and when you have to change or add anything you will need to change the code as well.
 
i didnt bother commenting on the fact there were only 8 options. I suppose technically they arent radio buttons either.

More like check boxes/selection boxes. In principle only one radio button can be selected at a time.
 
So I was thinking but maybe the OP dropped individual radio buttons onto the form to make them singletons.
 
Hello,

Thanks to all for all the comments.

I can't count apparently :D .

If radio buttons are not correct I guess check boxes or list box it is.

If the user selects A1 and A2 I would like a seperate entry for each.

I currently only have the simple standard new record button.
Code:
Option Compare Database
Private Sub Add_record_Click()
On Error GoTo Err_Add_record_Click
    DoCmd.GoToRecord , , acNewRec
Exit_Add_record_Click:
    Exit Sub
Err_Add_record_Click:
    MsgBox Err.Description
    Resume Exit_Add_record_Click
    
End Sub

This is my first vb / access database, I am willing to learn.

So I was thinking but maybe the OP dropped individual radio buttons onto the form to make them singletons.

Sorry vbaInet that does not make very much sense.

thanks again
 
no its not that - the round buttons are fine ... or check boxes - square ones with ticks in them.

its just that a radio button (like on a domestic radio) is normally set up so that only one button can be pressed in at any time. If you put a group of buttons inside an option group, it behaves in that way. you click one, and it deselects whichever one was previously selected.

And if you are used to seeing that behaviour, then it may be slightly disconcerting seeing a set of buttons behave in a different way.

which is why vbainet noted that you had used a number of round buttons as separate individual indicators.
 

Users who are viewing this thread

Back
Top Bottom