Open new form and apply a filter

DKM

Registered User.
Local time
Today, 06:28
Joined
Feb 24, 2007
Messages
24
Hi

I am using the after update function on one of the fields in my first form to trigger the opening and filtering of a second form.

I have 2 parts to this that i am trying to do.

Working from one form i am trying to open a second form and apply a filter based on a field from the first form (called ID). I have tried working it through the DoCmd.openform statement, as well as the Open Args statement on the second form, neither of these are working correctly (it gives me an 'expected end' error related to the Me. section.

The second thing i am trying to do is when the second form opens i only want to display the column related to the field i have just updated. Is there a way that i could hide all columns as the first action, and then unhide the one that i want to show?

Any help on these is appreciated.
 
You need to post the code you have used so we can offer suggestions. Both the WhereCondition argument of the OpenForm command as well as the OpenArgs argument will work when used properly.
 
sory, was working on theory initially. code im using is :

DoCmd.OpenForm "FrmJobInfo", acFormDS, , Me.JERef = [Forms]![FrmFactorScores]![JERef], acFormEdit, acWindowNormal

I have tried using the " " around parts based on other examples, but get an error message each time.

Forms!FrmJobInfo!JERef.ColumnHidden = -1
Forms!FrmJobInfo!AdditonalInfoKnowledge.ColumnHidden = -1
Forms!FrmJobInfo!AdditonalInfoCreativity.ColumnHidden = -1
Forms!FrmJobInfo!AdditonalInfoContacts.ColumnHidden = -1
Forms!FrmJobInfo!AdditonalInfoDiscretion.ColumnHidden = -1
Forms!FrmJobInfo!AdditonalInfoConsequences.ColumnHidden = -1
Forms!FrmJobInfo!AdditonalInfoResources.ColumnHidden = -1
Forms!FrmJobInfo!AdditonalInfoWorkDemands.ColumnHidden = -1
Forms!FrmJobInfo!AdditonalInfoPhysicalDemands.ColumnHidden = -1
Forms!FrmJobInfo!AdditonalInfoWorkConditions.ColumnHidden = -1
Forms!FrmJobInfo!AdditonalInfoWorkContext.ColumnHidden = -1

these work, but is there an easier way than entering the code leaving out the relvant column each time?
 
Try:
DoCmd.OpenForm "FrmJobInfo", acFormDS, , "[JERef] = " & Me.JERef
...if JERef is numeric or:
DoCmd.OpenForm "FrmJobInfo", acFormDS, , "[JERef] = '" & Me.JERef & "'"
...if JERef is text.
 

Users who are viewing this thread

Back
Top Bottom