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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|