Re: Cant figure this out !



Dave,

If you need to modify the record source of a subform query when status
changes, then on the status AfterUpdate event you need to redefine the query
for the subform. By clicking on the status events tab and creating the code
for the redefinition, the code would be something like this:

Procedure Status_AfterUpdate()
SubForm.Form.RecordSource = "SELECT ... FROM ... WHERE Status = " &
Status
End Procedure

Remember to change the name "SubForm" for your actual subform name.
Additionally, if you need to have an initial recordset on the load event of
the main form you can do:

Procedure Form_Load()
Status__AfterUpdate
End Procedure

Hope this helps!

--
________________
German Saer
gsaer@xxxxxxxxxxx
Orlando, FL


"Dave Elliott" <mynotebook@xxxxxxxxxxxxxx> wrote in message
news:u7pOe.148483$gL1.91587@xxxxxxxxxxxxxxxxxxxxxxx
> Ok, will try to simplify. the below code is in my query so that the form
> opens with a status of either active or archived records.
> The form also shows a list of employees and there status is either active
or
> archived.
> I need to be able to show ALL records when the status is archived instead
of
> either active or archived as my choices.
> The below code is in the query for the forms employees list and so shows
> only active or archived records.
> If the form is opened with a status of archived, then I need to see ALL
> records.
> I need to either change record source upon archive status or modify the
> below code to check if the form's status is archived.
>
>
>
> [Forms]![frmAutoPayrollReport]![Status] ' either active or archived is the
> choice here
>
>


.



Relevant Pages

  • Re: Suggestions Please - Subform Results Export to Excel
    ... In your situation the form and subform are both based on the same table. ... Setting up the query with criteria like ... In the criteria row for ProjectID, ... Record Source: SELECT tblHours_Worked.ProjectID, ...
    (microsoft.public.access.formscoding)
  • Re: Changing a combo box from unbound to bound!
    ... this query is not used for a record source in the subform. ... it to show all the products that do and do not have sub-components as well as ...
    (microsoft.public.access.gettingstarted)
  • Re: Expression Builder basic question on syntax / Or / how to incorporate a SQL query into a textbox
    ... But this is a SQL query ... subform, or a child table to a parent table), there are TWO record ... SECOND record source, namely the Query for the product problem above. ...
    (microsoft.public.access.formscoding)
  • Re: Problem with subform
    ... If the form's record source runs fine from the query ... design window, it should also work in the subform. ... I don't suppose the subform has its Filter property set to ...
    (microsoft.public.access.formscoding)
  • Combo Box Record Source from the Same Table as the Form
    ... the form is built on. ... I've tried building the form on a query. ... Access catches me and refuses to allow a combo box record source that has ... subform just seems way to clumsy, especially for a form that already has its ...
    (microsoft.public.access.forms)