473,398 Members | 2,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Using a button to make an entry into a databse

Hi,

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
9 2010
ADezii
8,834 Expert 8TB
Hi,

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
MSeda
159 Expert 100+
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
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
MSeda
159 Expert 100+
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
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
ex:
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
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 > docmd.run 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
Rabbit
12,516 Expert Mod 8TB
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
think of them like buttons on a cash register
Feb 18 '07 #9
Rabbit
12,516 Expert Mod 8TB
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

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

Similar topics

3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
1
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the...
1
by: Harry | last post by:
Hi, Slight problem in asp.net. (c#) I have a asp:panel page set up, with two different panels both of which contain a form. On the second page the user presses submit and the form details are...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
2
by: AA Arens | last post by:
When I add a button and choose in the wizzard for Delete Record operation, it does not work, instead it ADD's a record? How come? This is the VB contents of the button: Private Sub...
3
by: acecraig100 | last post by:
I am fairly new to Javascript. I have a form that users fill out to enter an animal to exhibit at a fair. Because we have no way of knowing, how many animals a user may enter, I created a table...
2
by: chitrapu | last post by:
hiii everybody, i have a little code that inserts the data into the databse. but the problem is the insertion should be peroformed only when a button is clicked. i have problems in this because i...
3
by: ElBeardo | last post by:
Hello, I´m new to Python.. so this is a newbee question. I´d like to put the value enterd in the entryfield in a variable. I´m trying to build a calculator with python and TKinter, coding it in...
8
by: Greg (codepug | last post by:
For lack of the proper expression, how do I excite a control to cause events to trigger. I have a date control and am using a calender form button to fill the text box with the date. The text box...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.