RE: 2nd form with recordset of 1st
- From: "'69 Camaro" <ForwardZERO_SPAM.To.69Camaro@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 25 Sep 2005 17:20:02 -0700
Hi, John.
> I have 2 forms. the first will show a filtered list of items. The 2nd will
> show details of 1 item selected from the first form.
Use the WHERE clause criteria to filter the 2nd form's records when it
opens. However, the Record Source of the form must have a primary key in
order to uniquely identify which record is needed.
In the following example, CurrRatesBtn is the name of the button that is
clicked to open the frmRates form (the 2nd form), ID is the primary key of
the Record Source of the second form, txtID is the name of the text box on
the current form displaying this primary key value. This example shows a
numeric value. A string value has slightly different syntax, so if you don't
know the syntax for a string, please post back.
Private Sub CurrRatesBtn_Click()
On Error GoTo ErrHandler
DoCmd.OpenForm "frmRates", acNormal, , "ID = " & Me!txtID.Value
Exit Sub
ErrHandler:
MsgBox "Error in CurrRatesBtn_Click( ) in " & Me.Name & " form." & _
vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & Err.Description
Err.Clear
End Sub
HTH.
Gunny
See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.
(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
"johnmate" wrote:
> I have 2 forms. the first will show a filtered list of items. The 2nd will
> show details of 1 item selected from the first form. I am currently using
> docmd.OpenForm on the first form.
>
> The problem is the recordset used for the forms is a quary and do to the
> size of the quary the 2nd form take a long time to load as it has to run the
> quary and searh the entire result everytime. The question is: Can I make the
> 2nd form use the filtered recordset from the first form for the detail view?
> or can I make the 2nd form reuse the quary data it already has in future
> searches?
>
> Any suggestions?
>
> thanks john
.
- Prev by Date: RE: Determining how many rows are selected - subform
- Next by Date: Re: Determining how many rows are selected - subform
- Previous by thread: RE: Determining how many rows are selected - subform
- Next by thread: RE: 2nd form with recordset of 1st
- Index(es):