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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
Klatuu wrote:
... but the best way to do it is like this: ????? really? -- Steve Schapel, Microsoft Access MVP |
#5
|
|||
|
|||
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 | |
|
|
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 |