473,401 Members | 2,125 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,401 software developers and data experts.

Save data entered when using [enter a value:] in SQL

Hello All!

I have a button on a form that is tied to the following query:

UPDATE tblSEQTAQ AS A
SET A.taqcall = [Enter a Value for Allele 1:]
WHERE (((A.taqcall)="Allele 1"));

The user looks at the form and decides to assign a code for the text Allele
1. It works fine.
The user now wants to see something like this on the form:

Allele 1: 2 2

2 2 was the text she typed in that replaced the text Allele 1 in the above
query. "Allele1:" above is a label. Is there a way to "store" the value she
entered (2 2) and display it?

The only solution I have thought of so far is to create a table that will
store these values and then use that table for a data source. This would
require the above query to write the values to two tables at once. I have
tried this unsuccessfully.

Any help will be greatly appreciated.

Stuart E. Wugalter
Zilkha Neurogenetic Institute
Keck School of Medicine
University of Southern California
wu******@usc.edu
Nov 12 '05 #1
3 1832
Hi,

On Fri, 19 Dec 2003 14:38:56 -0800, Stuart E. Wugalter wrote:
I have a button on a form that is tied to the following query:

UPDATE tblSEQTAQ AS A
SET A.taqcall = [Enter a Value for Allele 1:]
WHERE (((A.taqcall)="Allele 1"));

The user looks at the form and decides to assign a code for the text Allele
1. It works fine.
The user now wants to see something like this on the form:

Allele 1: 2 2

2 2 was the text she typed in that replaced the text Allele 1 in the above
query. "Allele1:" above is a label. Is there a way to "store" the value she
entered (2 2) and display it?


I suggest using a little code for that.
Instead of using an inputbox (provided via your parameter), query that
value from a small sub (quick-hack!):

sub UpdateData
dim varUserInput as variant

'get user's input
varuserinput = _
UserQuery(vbcrlf & "Enter a Value for Allel1 1:", _
"Data-Update")

'anything entered?
if not isnull(varuserinput) then
dim db as dao.database
db.execute
"UPDATE tblSEQTAQ AS A " & _
"SET A.taqcall = " & varuserinput & " " & _
"WHERE A.taqcall = " & chr(34) & Allele 1 & chr(34)

msgbox cstr(db.recordsaffected) & " record(s) have been updated.", _
vbinformation,"Data-update: Allele 1"

'here, you could transfer the user's input i.e. to a control on your form:
me!lblMyLabel.caption=varuserinput

set db=nothing
endif
end sub

The function UserQuery used above is from a sample that you may download
from my website (see sig) and which acts as a little more convenient
InputBox. However, using InputBox would be an alternative as well.

Cheers,
Olaf [MVP]
--
My .02: www.Resources.IntuiDev.com
Nov 12 '05 #2
Thank you Olaf. I am just learning VBA for Access, but I will try your code
and see if it works. In the mean time, if anyone knows of an SQL solution,
then please let me know. Thanks again, Stuart
"Olaf Rabbachin" <Ol*********@IntuiDev.com> wrote in message
news:bs*************@news.t-online.com...
Hi,

On Fri, 19 Dec 2003 14:38:56 -0800, Stuart E. Wugalter wrote:
I have a button on a form that is tied to the following query:

UPDATE tblSEQTAQ AS A
SET A.taqcall = [Enter a Value for Allele 1:]
WHERE (((A.taqcall)="Allele 1"));

The user looks at the form and decides to assign a code for the text Allele 1. It works fine.
The user now wants to see something like this on the form:

Allele 1: 2 2

2 2 was the text she typed in that replaced the text Allele 1 in the above query. "Allele1:" above is a label. Is there a way to "store" the value she entered (2 2) and display it?
I suggest using a little code for that.
Instead of using an inputbox (provided via your parameter), query that
value from a small sub (quick-hack!):

sub UpdateData
dim varUserInput as variant

'get user's input
varuserinput = _
UserQuery(vbcrlf & "Enter a Value for Allel1 1:", _
"Data-Update")

'anything entered?
if not isnull(varuserinput) then
dim db as dao.database
db.execute
"UPDATE tblSEQTAQ AS A " & _
"SET A.taqcall = " & varuserinput & " " & _
"WHERE A.taqcall = " & chr(34) & Allele 1 & chr(34)

msgbox cstr(db.recordsaffected) & " record(s) have been updated.", _
vbinformation,"Data-update: Allele 1"

'here, you could transfer the user's input i.e. to a control on your

form: me!lblMyLabel.caption=varuserinput

set db=nothing
endif
end sub

The function UserQuery used above is from a sample that you may download
from my website (see sig) and which acts as a little more convenient
InputBox. However, using InputBox would be an alternative as well.

Cheers,
Olaf [MVP]
--
My .02: www.Resources.IntuiDev.com

Nov 12 '05 #3
"Stuart E. Wugalter" <wu******@usc.edu> wrote in message news:<br**********@gist.usc.edu>...
Hello All!

I have a button on a form that is tied to the following query:

UPDATE tblSEQTAQ AS A
SET A.taqcall = [Enter a Value for Allele 1:]
WHERE (((A.taqcall)="Allele 1"));

The user looks at the form and decides to assign a code for the text Allele
1. It works fine.
The user now wants to see something like this on the form:

Allele 1: 2 2

2 2 was the text she typed in that replaced the text Allele 1 in the above
query. "Allele1:" above is a label. Is there a way to "store" the value she
entered (2 2) and display it?

The only solution I have thought of so far is to create a table that will
store these values and then use that table for a data source. This would
require the above query to write the values to two tables at once. I have
tried this unsuccessfully.

Any help will be greatly appreciated.

Stuart E. Wugalter
Zilkha Neurogenetic Institute
Keck School of Medicine
University of Southern California
wu******@usc.edu


Probably a LOT easier if you use an unbound form to grab the value.
Then you could do something like (1) write the value to a table; (2)
execute the query.

For (1) you could either open an recordset based on the table and
insert a record or do something like....

CurrentDB.Execute "INSERT INTO MyTable(Field1,Field2) VALUES (" &
Forms!MyForm!TxtField1 & ",'& Forms!MyForm!numField2
&");",dbFailOnError

DoCmd.OpenQuerydef("MyQuery")

....
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rick | last post by:
Hello, I'm having trouble with submitting my form when checking to see if data is present in the user-inputted fields. What I want to happen is for the user to input various pieces of data,...
0
by: Doc | last post by:
Would you enter this in as an "event procedure" or right in the properties of the combo box under event / afterupdate. I kept getting an error message that it could not find the Macro "Me!", when I...
2
by: Josh Strickland | last post by:
I am attempting to create an Access database which uses forms to enter data. The issue I am having is returning the query results from the Stored Procedure back in to the Access Form. ...
0
by: Dune | last post by:
Hi there, I have an aspx page that allows users to enter several parameters using drop downs and text boxes. The users then press a button that produces an extract based on the parameters they...
6
by: kurt | last post by:
Hi all, I have something that has me stumped. I have a webform that has several text boxes. Each of these boxes has the textchanged set so when the user enters text and leaves the textbox, it...
5
by: DBQueen | last post by:
I have a database where the user will have the opportunity to set up a number of Tests. I want the user to be able to enter the equation if a field for a particular test is to be a calculated...
2
by: Jim | last post by:
When I manually enter data into a bound textbox then point my cursor to my Save button and press Save the data I just entered data does not save. However if I move my cursor to another text box or...
15
by: Mr.Tom.Willems | last post by:
Hello people, I am ussing an MS access database to enter and manage data from lab tests. until now i was the only one handeling the data so i had no need for a controle on how missing data was...
2
by: KC-Mass | last post by:
I have a form that is used to ID and then load Excel files into Access. I use labels on the form to record which file was last loaded. That was accomplished with a simple lblFileLoaded =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.