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  

Filter 2nd form based on field value of 1st form



 
 
Thread Tools Display Modes
  #1  
Old January 10th, 2010, 07:13 PM posted to microsoft.public.access.forms
Yara
external usenet poster
 
Posts: 19
Default Filter 2nd form based on field value of 1st form

Hi there,
I have a mainform with 3 subforms included. On the first subform there is a
combobox field [CboEquipmment]. When I press a button I would like to have
another form opened that is filtered so that it shows only the relevant
records. The first form name is SubfrmEquipment and is based on a table
TblEquipment. The 2nd form is named FrmFunction and is also based on the
TblEquipment. The 2nd form is a continous form.

I hope that I have explained the situation so that someone can help me with
this.

Any help is much appreciated!

Yara
  #2  
Old January 10th, 2010, 09:39 PM posted to microsoft.public.access.forms
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default Filter 2nd form based on field value of 1st form

On Sun, 10 Jan 2010 11:13:01 -0800, Yara
wrote:

DoCmd.OpenForm "FrmFunction", , , "EquipmentID=" & Me.CboEquipment
I'm assuming your combobox has two columns, EquipmentID and
EquipmentName.

-Tom.
Microsoft Access MVP


Hi there,
I have a mainform with 3 subforms included. On the first subform there is a
combobox field [CboEquipmment]. When I press a button I would like to have
another form opened that is filtered so that it shows only the relevant
records. The first form name is SubfrmEquipment and is based on a table
TblEquipment. The 2nd form is named FrmFunction and is also based on the
TblEquipment. The 2nd form is a continous form.

I hope that I have explained the situation so that someone can help me with
this.

Any help is much appreciated!

Yara

  #3  
Old January 12th, 2010, 07:08 PM posted to microsoft.public.access.forms
Yara
external usenet poster
 
Posts: 19
Default Filter 2nd form based on field value of 1st form

Hi Tom,

Thanks for your code.

I have tried to use the code you have posted but it doesn't work. I get the
debug prompt. Can you give more info?

I am using subfrmEquipment with CboEquipment (your assumprion was correct it
has 2 columns). By pressing a cmdbutton a form named FrmFunction should be
opened and filtered based on the value in CboEquipment. The form FrmFunction
is a continious form. Both forms have the TblEquipment as source.
What am I doing wrong?

Regards,
Mireille



"Tom van Stiphout" wrote:

On Sun, 10 Jan 2010 11:13:01 -0800, Yara
wrote:

DoCmd.OpenForm "FrmFunction", , , "EquipmentID=" & Me.CboEquipment
I'm assuming your combobox has two columns, EquipmentID and
EquipmentName.

-Tom.
Microsoft Access MVP


Hi there,
I have a mainform with 3 subforms included. On the first subform there is a
combobox field [CboEquipmment]. When I press a button I would like to have
another form opened that is filtered so that it shows only the relevant
records. The first form name is SubfrmEquipment and is based on a table
TblEquipment. The 2nd form is named FrmFunction and is also based on the
TblEquipment. The 2nd form is a continous form.

I hope that I have explained the situation so that someone can help me with
this.

Any help is much appreciated!

Yara

.

  #4  
Old January 13th, 2010, 01:32 PM posted to microsoft.public.access.forms
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default Filter 2nd form based on field value of 1st form

On Tue, 12 Jan 2010 11:08:01 -0800, Yara
wrote:

Set a breakpoint at this line. When you stop at this line, in the
immediate window, write:
?Me.CboEquipment
I expect it will return with a numeric value, e.g. 5.
That means that essentially we are executing:
DoCmd.OpenForm "FrmFunction", , , "EquipmentID=" & 5
and that should work, if indeed this form is bound to a table (or
query) with EquipmentID in it.
If EquipmentID is a text value, you should wrap single-quotes around
it:
DoCmd.OpenForm "FrmFunction", , , "EquipmentID='" & Me.CboEquipment &
"'"

-Tom.
Microsoft Access MVP


Hi Tom,

Thanks for your code.

I have tried to use the code you have posted but it doesn't work. I get the
debug prompt. Can you give more info?

I am using subfrmEquipment with CboEquipment (your assumprion was correct it
has 2 columns). By pressing a cmdbutton a form named FrmFunction should be
opened and filtered based on the value in CboEquipment. The form FrmFunction
is a continious form. Both forms have the TblEquipment as source.
What am I doing wrong?

Regards,
Mireille



"Tom van Stiphout" wrote:

On Sun, 10 Jan 2010 11:13:01 -0800, Yara
wrote:

DoCmd.OpenForm "FrmFunction", , , "EquipmentID=" & Me.CboEquipment
I'm assuming your combobox has two columns, EquipmentID and
EquipmentName.

-Tom.
Microsoft Access MVP


Hi there,
I have a mainform with 3 subforms included. On the first subform there is a
combobox field [CboEquipmment]. When I press a button I would like to have
another form opened that is filtered so that it shows only the relevant
records. The first form name is SubfrmEquipment and is based on a table
TblEquipment. The 2nd form is named FrmFunction and is also based on the
TblEquipment. The 2nd form is a continous form.

I hope that I have explained the situation so that someone can help me with
this.

Any help is much appreciated!

Yara

.

  #5  
Old January 14th, 2010, 06:55 PM posted to microsoft.public.access.forms
Yara
external usenet poster
 
Posts: 19
Default Filter 2nd form based on field value of 1st form

Hi Tom,

Thanks again for your support. I have done exactly what you said and it gave
back a number just as you said. I have tried al sorts of combinations but
nothing seemed to help. Eventually I have started all over again and now it
works fine.
So something was wrong with a table or form or so.
Thanks again!

Regards,
Yara

"Tom van Stiphout" wrote:

On Tue, 12 Jan 2010 11:08:01 -0800, Yara
wrote:

Set a breakpoint at this line. When you stop at this line, in the
immediate window, write:
?Me.CboEquipment
I expect it will return with a numeric value, e.g. 5.
That means that essentially we are executing:
DoCmd.OpenForm "FrmFunction", , , "EquipmentID=" & 5
and that should work, if indeed this form is bound to a table (or
query) with EquipmentID in it.
If EquipmentID is a text value, you should wrap single-quotes around
it:
DoCmd.OpenForm "FrmFunction", , , "EquipmentID='" & Me.CboEquipment &
"'"

-Tom.
Microsoft Access MVP


Hi Tom,

Thanks for your code.

I have tried to use the code you have posted but it doesn't work. I get the
debug prompt. Can you give more info?

I am using subfrmEquipment with CboEquipment (your assumprion was correct it
has 2 columns). By pressing a cmdbutton a form named FrmFunction should be
opened and filtered based on the value in CboEquipment. The form FrmFunction
is a continious form. Both forms have the TblEquipment as source.
What am I doing wrong?

Regards,
Mireille



"Tom van Stiphout" wrote:

On Sun, 10 Jan 2010 11:13:01 -0800, Yara
wrote:

DoCmd.OpenForm "FrmFunction", , , "EquipmentID=" & Me.CboEquipment
I'm assuming your combobox has two columns, EquipmentID and
EquipmentName.

-Tom.
Microsoft Access MVP


Hi there,
I have a mainform with 3 subforms included. On the first subform there is a
combobox field [CboEquipmment]. When I press a button I would like to have
another form opened that is filtered so that it shows only the relevant
records. The first form name is SubfrmEquipment and is based on a table
TblEquipment. The 2nd form is named FrmFunction and is also based on the
TblEquipment. The 2nd form is a continous form.

I hope that I have explained the situation so that someone can help me with
this.

Any help is much appreciated!

Yara
.

.

 




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


All times are GMT +1. The time now is 01:15 PM.


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