A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

More on selecting records on a sub form -



 
 
Thread Tools Display Modes
  #1  
Old April 7th, 2005, 07:39 AM
Abay
external usenet poster
 
Posts: n/a
Default More on selecting records on a sub form -

I think my question should have been .. how do I pass a parameter from a
form through a macro to a query .. i.e. what I want to do is to select all
transactions for the Client whose data is on the sub form, using the
Client's LastName as the selection criteria ..

abay


  #2  
Old April 7th, 2005, 10:51 AM
Steve Schapel
external usenet poster
 
Posts: n/a
Default

Abay,

This is not a job for a macro. And a query can't get data from a form.
The good news is that it actually simpler than that. All you need to
do is make a query based on your table, and in the Criteria of the
LastName field, put the equivalent of this...
[Forms]![NameOfYourForm]![LastName]

--
Steve Schapel, Microsoft Access MVP


Abay wrote:
I think my question should have been .. how do I pass a parameter from a
form through a macro to a query .. i.e. what I want to do is to select all
transactions for the Client whose data is on the sub form, using the
Client's LastName as the selection criteria ..

abay


  #3  
Old April 7th, 2005, 02:41 PM
Klatuu
external usenet poster
 
Posts: n/a
Default

Sorry, Steve, you are only partially correct. The correct parts are that it
should not be a macro. If the action of the macro is needed, convert it to
code and put it where the macro is called. Your statement that a query can't
get data from a form is correct, but the best way to do it is like this:

Put something like this in the click event of the command button:

Set qdf = CurrentDb.QueryDefs("qselSCCBhdr")
qdf.Parameters(0) = Me.cboResource
qdf.Parameters(1) = Me.cboPeriod
Set rstItms = qdf.OpenRecordset(dbOpenSnapshot, dbReadOnly)


"Steve Schapel" wrote:

Abay,

This is not a job for a macro. And a query can't get data from a form.
The good news is that it actually simpler than that. All you need to
do is make a query based on your table, and in the Criteria of the
LastName field, put the equivalent of this...
[Forms]![NameOfYourForm]![LastName]

--
Steve Schapel, Microsoft Access MVP


Abay wrote:
I think my question should have been .. how do I pass a parameter from a
form through a macro to a query .. i.e. what I want to do is to select all
transactions for the Client whose data is on the sub form, using the
Client's LastName as the selection criteria ..

abay



  #4  
Old April 7th, 2005, 07:02 PM
Steve Schapel
external usenet poster
 
Posts: n/a
Default

Klatuu wrote:

... but the best way to do it is like this:

????? really?

--
Steve Schapel, Microsoft Access MVP
  #5  
Old April 7th, 2005, 07:28 PM
Abay
external usenet poster
 
Posts: n/a
Default

Many thanks to all for your suggestions .. will try them out ..

abay

"Steve Schapel" wrote in message
...
Abay,

This is not a job for a macro. And a query can't get data from a form.
The good news is that it actually simpler than that. All you need to
do is make a query based on your table, and in the Criteria of the
LastName field, put the equivalent of this...
[Forms]![NameOfYourForm]![LastName]

--
Steve Schapel, Microsoft Access MVP


Abay wrote:
I think my question should have been .. how do I pass a parameter from a
form through a macro to a query .. i.e. what I want to do is to select

all
transactions for the Client whose data is on the sub form, using the
Client's LastName as the selection criteria ..

abay




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting records on sub form Abay Using Forms 1 April 7th, 2005 03:59 PM
Dates in a listbox connected to a form... RusCat Using Forms 13 November 25th, 2004 02:31 AM
Need query to separate 2 entry types in a table field Jan Il Running & Setting Up Queries 31 November 23rd, 2004 05:57 PM
SELECTING RECORDS FROM FORM ADD MODE albertsong Running & Setting Up Queries 4 November 18th, 2004 09:49 PM
Cannot view multiple records in Form view Heather Using Forms 5 August 12th, 2004 07:59 PM


All times are GMT +1. The time now is 12:14 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.