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

Row Source SQL query question.

How do I include a where clause that contains a form value in a Row
Source SQL query? This is in the form properities under DATA.

SELECT [Categories].[CategoryName] FROM Categories WHERE Catogories.id
= Me![id];

The "Me![id]" is a form control.

Nov 13 '05 #1
2 3834
Karen Hill wrote:
How do I include a where clause that contains a form value in a Row
Source SQL query? This is in the form properities under DATA.

SELECT [Categories].[CategoryName] FROM Categories WHERE Catogories.id
= Me![id];

The "Me![id]" is a form control.

Usually you do something like this
Dim strSQL As STring
dim rst As Recordset
strSQL = "SELECT [Categories].[CategoryName] " & _
"FROM Categories " & _
"WHERE Catogories.id = " & Me![id];
set rst = currentdb.openrecordset(strSQL,dbopendynaset)

If you are in the query builder, you need to know the name of the form
SELECT [Categories].[CategoryName] _
FROM Categories _
WHERE Catogories.id = Forms!YourFormName!ID
Nov 13 '05 #2

"Karen Hill" <ka**********@yahoo.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
How do I include a where clause that contains a form value in a Row
Source SQL query? This is in the form properities under DATA.

SELECT [Categories].[CategoryName] FROM Categories WHERE Catogories.id
= Me![id];

The "Me![id]" is a form control.


The "Me" shorcut notation can only be used in VBA code in the Form's or
Report's module. To use such a reference in RowSource (or in an expression
in a Control's ControlSource), you have to use the fully-qualified
reference, such as

Forms!frmYourForm!id

Larry Linson
Microsoft Access MVP
Nov 13 '05 #3

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

Similar topics

3
by: Seba | last post by:
For db2 UDB I need to get dependency information for views. What I'm looking for is the tables that have the source information for the view. i.e. : if the following view was defined in my...
2
by: aleatory | last post by:
Hi Access masters, Sorry for asking a very simple question, but how could I locate source tables which have been linked into the Access database? The following is an ASCII- based screen shot: ...
115
by: TheAd | last post by:
At this moment I use MsAccess and i can build about every databound application i want. Who knows about a serious open source alternative? Because Windows will be a client platform for some time, i...
5
by: Cro | last post by:
Hello Access Developers, I'd like to know if it is possible to perform a count in an expression that defines a control source. My report is based on a query. In my report, I want a text box to...
4
by: Bob Sanderson | last post by:
I am using a form to select a table and then opening a report using the selected table as the record source. This is a simplified description of what I'm doing. First, cboSelectBOM selects the...
2
by: Bob | last post by:
I've got a bound report with a query as the record source. I'm adding a total to the footer and have inserted a text box to display it. I'm attempting to set the control source of the text box to...
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
0
by: Helmut Kotsch | last post by:
Hi, this drives me crazy, 4 years ago I defined in an ACCESS 2000 application a "PivotTable-Form". The resulting EXCEL table inclusive the "Data refresh" works perfect. I now want to...
1
by: OllyJ | last post by:
Hi guys, probably an easy one for you. I know how to limit a row source sor a combo on a form (setting unique values). The problem i'm having is that the query is the record source for a...
7
by: Henry J. | last post by:
I got a dumb question on the merge statement. I read the following example of merge statement at the IBM page:...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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.