473,804 Members | 3,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing information from a form to SQL

I am a novice with SQL - I usually work in the query grid. However I
am trying to find a way to change a field name depending upon what I
select from a combo box on a form. I created an unbound form allows me
to select any one of 20 field names from the Questionnaire table. When
I select a new one, for example "Discharges ", I want to replace the
field "Admissions " (in the SQL below) with it. I have a button on my
form that Runs Query. Can I insert some code in the On Click of that
button to change my SQL statement?
SELECT Questionnaire.[Fiscal Year], Questionnaire.Q uarter,
Count(Questionn aire.[ID Code]) AS [Admissions Questions Samples]
FROM Questionnaire
WHERE (((Questionnair e.Admissions) Is Not Null And
(Questionnaire. Admissions)<>0) AND
((Questionnaire .OmitFromAnalys is)=False))
GROUP BY Questionnaire.[Fiscal Year], Questionnaire.Q uarter;
Any help is very much appreciated.

Nov 16 '05 #1
1 1230

"Delores" <de******@shaw. ca> wrote
However I
am trying to find a way to change a field name depending upon what I
select from a combo box on a form. I created an unbound form allows me
to select any one of 20 field names from the Questionnaire table. When
I select a new one, for example "Discharges ", I want to replace the
field "Admissions " (in the SQL below) with it. I have a button on my
form that Runs Query. Can I insert some code in the On Click of that
button to change my SQL statement?


Dim src As String
dim fName As String

fName = Me!cboFieldName .Value

src = "SELECT Questionnaire.[Fiscal Year], Questionnaire.Q uarter, " & _
"Count(Question naire.[ID Code]) AS [Admissions Questions Samples] " & _
"FROM Questionnaire " & _
"WHERE Questionnaire." & fName & " Is Not Null And " & _
"(Questionnaire ." & fName & "<>0) AND " & _
"(Questionnaire .OmitFromAnalys is=False) " & _
"GROUP BY Questionnaire.[Fiscal Year], Questionnaire.Q uarter"

--
Darryl Kerkeslager
Nov 16 '05 #2

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

Similar topics

5
5945
by: Paul | last post by:
I want to use sessions to cover myself in case the user switches off cookies so I am passing the session ID manually through a hidden input field. This is what I have so far. index.php page contains: <?php $_SESSION = ""; $_SESSION = "";
1
7790
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains: ---------------------------------------------------------------------------- <?php ini_set("session.use_cookies", "off"); ini_set("session.use_trans_sid", "on"); session_start(); $_SESSION = ""; $_SESSION = ""; echo "<form method='POST' action='login.php'>
3
4761
by: Simon Harvey | last post by:
Hi, In my application I get lots of different sorts of information from databases. As such, a lot of information is stored in DataSets and DataTable objects. Up until now, I have been passing around chunks of data in DataTables/DataSets, simply because that was the format that they were in when the data was taken from the database. Now, I know this maybe a pretty silly question with a standard "it depends" answer, but I'm going to...
6
3955
by: Max | last post by:
Last time I tried to explain this on another forum it didn't go too well, so I'll try my best and if you know what I'm talking about then please tell me how to do this. I have a class, inside I have some public functions and private variables. Inside the class I also have a declaration of a new form object. One of the functions of the class takes that form object, shows it with showdialog and the basically passes the control to the form...
7
1913
by: Drum2001 | last post by:
I am creating a database to track employee time. I have created a form that allows them to select from a combo box their task, enter their hours, and add any comments they may have. In the event "Reporting Request" is selected from the Combo box, another form pops up IN FRONT of it, allowing for additional information. On the Pop-up form, there is an area for "Time" and "Summary"... Is there anyway to have this information pass to...
2
2561
by: whitc26 | last post by:
Let me preface: I'm a novice, and have no programming experience. I have created an access database and have a few tables in it. I have created a form called "clients" This form opens up and has alot of basic client information in it, nothing fancy, no code (other than what access has put in). I have created a second form "newVisit" This form has a subform on it called "client visit subform". The form is just to be used to record...
7
10396
by: AMP | last post by:
Hello, I have this in form1: namespace Pass { public partial class Form1 : Form { public Form2 form2; public Form1() {
1
1827
by: rfr | last post by:
I have a need to use a single version of a Visitor Response Feedback Form on numerous HTML documents. Rather than have numerous versions of this, one on each HTML document, it makes more sense to have ONE FORM and use it from each HTML document that needs it. But, the visitor should see a title on the form that relates to the specific page about which they are giving the feedback. And the results of the form must include what page was...
10
2053
by: patelxxx | last post by:
Problem: I am trying to input my name in a text box and I click on transfer and I want the name to appear on the same page (i.e. in another form). How is this done? <BODY> <HTML> <form id="form1", action="testing.htm" method="post"> Your name: <input type="text" name="name"/> </form>
4
5941
by: John Sheppard | last post by:
Hello there I was wondering if anyone could help me, I am trying to pass a typed dataset to a dialoged child form by reference. I have binding sources sitting on the child form. So to refresh them I just set their datasource. I am guessing this is probably what is causing the problem. Is there a better way to do this? Anyway this all works happily and things show up when the record already exists but I have 2 problems ; 1) When I add...
0
9708
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10588
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10085
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.