By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,165 Members | 840 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,165 IT Pros & Developers. It's quick & easy.

Using a button to make an entry into a databse

P: 32

If i have a page full of buttons, and each button has a fixed value, which will never change, how can i get the click of the button to enter its fixed value into a table?
Feb 14 '07 #1
Share this Question
Share on Google+
9 Replies

Expert 5K+
P: 8,638

If i have a page full of buttons, and each button has a fixed value, which will never change, how can i get the click of the button to enter its fixed value into a table?
What is this Fixed Value that you are referring to?
Feb 14 '07 #2

Expert 100+
P: 159
you need an option group. its a group of controls that only allows user to select one each one has an assigned numeric value.

Check it out and let us know if you need more help.
Feb 14 '07 #3

P: 32
lets say there are 10 buttons, named a to j. a has a value of 1, b's value is 2, c value is 3, and so on.

the value of each button will never change.

When i click that button, its value is stored. I may press a number of buttons, and want to store each value until a click a final button to end the ability to click any further
Feb 15 '07 #4

Expert 100+
P: 159
Well, sort of. Each button does have a value that never changes. Its actually the frame (or the option group as whole) that has the value.

An option group operates a lot like a list box in that it is a control that contains options for the user to choose from, the ‘buttons’ in the frame are not controls in and of themselves the are just a means to set the value of the frame which is the actual control, but rather than those options being derived from a row source an option group has member controls with pre-designated numeric values.

As far as choosing multiple values, you didn’t clearly say in what capacity you wished to store the multiple entries. If your data is properly normalized your wanting to create a series of records. This is possible to do but will require some additional programing.

I’d recommend first try to create an option group using the wizards in access and then once you had a chance to play with it a little post back with more info on how you want your form to operate if you still need help.
Feb 16 '07 #5

P: 42
If I understand what do you mean:
you have, let's say 10 buttons from 1 to 10, and each time you click on a button the value of that button is added to a string and when you finish you click on the final button to save it in the table.

First You have to declare a global variable Str1

Then for each command you have to fill the On_Click Event with:
Str1=Str1 + Command1.value
for each command its own command value
Private Sub Command1_Click()
Str1 = Str1 + Command1.Caption
End Sub
Private Sub Command2_Click()
Str1 = Str1 + Command2.Caption
End Sub
Finaly you should create one last button "Submit" and fill the On_Click Event with:
Private Sub Submit_Click()
DoCmd.RunSQL ("insert into TableName values('" & x & "')")
End Sub
Feb 17 '07 #6

P: 32
i had a brainwave.

Would it not be a much simpler solution to use the following (from memory so may be slightly inaccurate

on click > a query

query = sql statement

SELECT tablename
INSERT INTO entity name
VALUES buttons set value;

I like the look of your solution but it seems far too complicated. or would it be possible for you to elaborate?

Thanks for the help by the way, much appreciated. I just want to find the most simple solution and easiest to apply
Feb 17 '07 #7

Expert Mod 10K+
P: 12,366
The problem is we can't tell if your solution is best for you because we don't know how you're storing your data. What do these multiple checkboxes represent and how do they relate to your records?
Feb 17 '07 #8

P: 32
think of them like buttons on a cash register
Feb 18 '07 #9

Expert Mod 10K+
P: 12,366
Okay, so it's like some sort of inventory tracking system?

But how is it stored in the data, what's the table structure?
Feb 18 '07 #10

Post your reply

Sign in to post your reply or Sign up for a free account.