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

Query current record

I am new to Access. I have a form with a single record. The keyed field is
PropID (number). I want to run a query from the form that will have the
current value of PropID be the variable in the criteria of the query. The
intent being the query returns the values of the current record of the form
for a report. So, I want to code a pushbutton to run that query with the
current keyed field value as the criteria and then open a report based on
that query. How do I do this in Access. I can do this in other desktop
RDBM programs.
Nov 13 '05 #1
1 4560
"Michael Israel" <mb***@spamlessoptonline.net> wrote in
news:og*********************@news4.srv.hcvlny.cv.n et:
I am new to Access. I have a form with a single record. The
keyed field is PropID (number). I want to run a query from
the form that will have the current value of PropID be the
variable in the criteria of the query. The intent being the
query returns the values of the current record of the form
for a report. So, I want to code a pushbutton to run that
query with the current keyed field value as the criteria and
then open a report based on that query. How do I do this in
Access. I can do this in other desktop RDBM programs.


Rather than put the query criteria in the recordsource of the
report, you can call the Docmd.openreport method with an optional
WHERE clause that filters the report recordsource.

So in the report calling code, first set up your criteria, then
pass that asa follows

Private sub CmdReportPvw_OnClick ()
Dim stReportname as string
Dim stwhereclause as string

streportname = "MyReport"
stwhereclause = "PropID = " & me.PropID ' For numeric ID
stwhereclause = "PropID = " & chr(34)& me.PropID & me.chr(34) '
For characeter ID

DoCmd.OpenReport streportname, , ,stwhereclause

End sub.
Bob Quintal

Nov 13 '05 #2

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

Similar topics

2
by: Paul Wagstaff | last post by:
Hi there I have 2 tables: tblAccuracy & tblClearance Users add new records to tblAccuracy using frmRegister. Under specific conditions I need to append the current record from frmRegister into...
4
by: Trey | last post by:
How do I tell an update query to only search the records that are older then the current record? I need to figure out how to write a query that will take a record, look to see if any record...
5
by: Bob Weisenburger | last post by:
I have a table of "memos". each record in that table has a primary key "memo ID" that is autonumber. I have another table that is "memo receipts" with each record having a "receipt id" field that...
6
by: kenshiro | last post by:
Hi All, I'm having a problem with some VBA code in one of my Access 2003 databases. I'm getting the following error when running code behind a command button on a form: "Item not found in this...
8
by: kepston | last post by:
I have a situation where I need to record scrap quantities for parts that we sell and parts that are supplied, in a single table. I have a UNION query that combines the part numbers successfully,...
1
by: Andy_Khosravi | last post by:
Background: Access 2003 (converted from A97 DB recently), database is split into FE/BE with the FE residing on client machine. I've got a question about how I can possibly optimize a query I've...
12
by: Michel Esber | last post by:
Hello, Db2 Linux LUW FP 15. Consider table A (ID varchar, EXECUTION_DATE date). a) I want to first retrieve all IDs that have not executed during the last 90 days: select distinct ID...
11
by: lenygold via DBMonster.com | last post by:
Hi everybody! This query is supposed to count consecutive years from the current year without OLAP. Input Table: ID DateCol 1 02/01/2006 1 01/01/2006 1 01/01/2005
7
by: shalskedar | last post by:
In a query i want to retrieve the value in such a way that if the value for the current record for a given column is 0 then it should go to the next record & take the value. for ex-I 've column...
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...
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
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
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
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.