473,511 Members | 15,852 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Querry on multiple forms

Hi gurus!

I want to setup a query that uses data from a field from the currently
open form. Is there a way to do that? i.e. I don't want the query to
be form specific, but to work with any form, as long as it is the
current form. I tried to use "Me" in the query, but it didn't work...
Also even though there is a currentDB command there is no CurrentForm
:(

any ideas?

thank you in advance

Laertes
Nov 12 '05 #1
1 1177
DFS
One way:

To work with any form, any field, you'll have to code something into the
AfterUpdate event of each field, like:

if not isnull(me.FieldName) then call SearchDB(Me.FieldName, dataTypePassed)

(SearchDB is a function that updates the SQL of your query with the value
passed to it
Me.FieldName is the name of the field on the form
dataTypePassed is "number" or "text" or "date" )

Public Sub SearchDB(queryVal as Variant, dataTypePassed as String)
Set qItem = db.QueryDefs("query name")

if dataTypePassed = "number" then
qItem.SQL = "SELECT * FROM TABLE WHERE FIELD = " & queryVal & ";"
elseif dateTypePassed = "text" then
qItem.SQL = "SELECT * FROM TABLE WHERE FIELD = '" & queryVal & "';"
elseif dateTypePassed = "date" then
qItem.SQL = "SELECT * FROM TABLE WHERE FIELD = #" & queryVal & "#;"
endif

qItem.Close
db.QueryDefs.Refresh
End Sub


"Laertes" <bi******@btopenworld.com> wrote in message
news:b2**************************@posting.google.c om...
Hi gurus!

I want to setup a query that uses data from a field from the currently
open form. Is there a way to do that? i.e. I don't want the query to
be form specific, but to work with any form, as long as it is the
current form. I tried to use "Me" in the query, but it didn't work...
Also even though there is a currentDB command there is no CurrentForm
:(

any ideas?

thank you in advance

Laertes

Nov 12 '05 #2

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

Similar topics

4
3020
by: Eric Kincl | last post by:
Hey everyone, I know this isn't a SQL group, but I'm on my colleges news server and they don't offer one. Hopefully someone here will be able to help me. I have a database that is normalized...
2
3184
by: Eric Kincl | last post by:
Hello, I have an array of data in PHP. I would like to insert each member of the array into it's own row in SQL. The array is of variable length, so it would have to be dynamic code. How would...
0
1587
by: Costa Lino | last post by:
Hi All, I have a DataSet with xml file and I want to make a querry like this DataView dv = new DataView(mytable); dv.RowFilter = " Impression < ( MaxImpressions) "; Impression et...
5
1836
by: Clownfish | last post by:
OK, I'm having a brain freeze. I have a table like this: Office Name Phone ---------------------------------- SG Larry 555-1212 SG Moe 553-4444 SG Curly ...
5
14104
by: c676228 | last post by:
Hi everyone, my colleagues are thinking about have three insurance plans on one asp page: I simplify the plan as follow: text box:number of people plan1 plan2 plan3
6
2631
by: Bob Alston | last post by:
Looking for someone with experience building apps with multiple instances of forms open. I am building an app for a nonprofit organizations case workers. They provide services to the elderly. ...
1
1736
Steve Kiss
by: Steve Kiss | last post by:
Hi. I am developping a site for which one of the pages uses querry strings to pass some parameters. I can use the querry strings if I call the page from a plain html anchor. However, when I add the...
1
1481
by: nj2md | last post by:
Can some one assist with a querry. I need to know the code to querry a database to find the number of female and males that make over 50K a year and how to get capital gains and loses from the same...
0
1255
by: getmeidea | last post by:
I have the following tables, 1> employee_master(emp_id int primary key, emp_name varchar(100)); 2> employee_salary_payment(salary_rid int primary key, emp_id int, sal_date date, paid_amt int); ...
2
1441
by: dipalichavan82 | last post by:
i came across a article, where it was mentioned if we want a dynamic querry to fire then use parameterized querry e.g. string inputcity=textbox.text; SqlCommand cmd = new SqlCommand("select * from...
0
7353
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
7418
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...
1
7075
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
7508
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
5662
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,...
1
5063
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...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1572
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 ...
0
446
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...

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.