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
|
|||
|
|||
On Open
I'd like to open a form and filter based on another form's combo box.
The form and cbox is: frmFinishedGoods.cbProfileID The form I'd like to open based on the above form's cbox is: frmQueryFGProcessingFacIDsLineIDs.cbNavigateProfil es cbProfileID and cbNavigateProfiles source the same table and field. I'd like cbNavigateProfiles to filter to the record in cbProfileID. How can I code the On Open property of my form to achieve this? Thanks for your help! -- www.Marzetti.com |
#2
|
|||
|
|||
On Open
|
#3
|
|||
|
|||
On Open
Thanks, Albert!
I created a button that opens forms from a combobox list. I open the form through this. I placed the code in the form's On Open property. When I execute the button I'm asked to enter in a parameter for cbProfileID. The debugger points to this line: DoCmd.OpenForm "frmQueryFGProcessingFacIDsLineIDs", , , strWhere ??? -- www.Marzetti.com "Albert D. Kallal" wrote: Well, where in code do you open this new form? Just use the where clause as follows: dim strWhere as string strWhere = "cbProFileID = " & forms!frmFinishedGoods!cbProfileID docmd.Openform "frmQueryFGProcessingFacIdsLindID",,,strWhere -- Albert D. Kallal (Access MVP) Edmonton, Alberta Canada |
#4
|
|||
|
|||
On Open
I placed the code in the form's On Open property. When I execute the button I'm asked to enter in a parameter for cbProfileID. The debugger points to this line: DoCmd.OpenForm "frmQueryFGProcessingFacIDsLineIDs", , , strWhere ??? Why would we place the above code in the on-open event? Try reading the code before pasting it!!! The docmd.OpenForm will OPEN a ms-access form. So, common sense would seem to indicate that we want to place this code behind the button on our first form. So, remove the code from the forms on-open. We don't need it. further, the "strWhere" code is critical for correct operation, and you failed to post/include this in your question. (did you forget this by accident, or did you not realizes that the strWhere part is the whole key concept to make this work). So, we don't need any code in the forms on-open event. the ONLY place we need code is behind our button on the form. -- Albert D. Kallal (Access MVP) Edmonton, Alberta Canada |
#5
|
|||
|
|||
On Open
"JohnLute" wrote in message
I'd like to open a form and filter based on another form's combo box. The form and cbox is: frmFinishedGoods.cbProfileID The form I'd like to open based on the above form's cbox is: frmQueryFGProcessingFacIDsLineIDs.cbNavigateProfil es cbProfileID and cbNavigateProfiles source the same table and field. I'd like cbNavigateProfiles to filter to the record in cbProfileID. How can I code the On Open property of my form to achieve this? Thanks for your help! Hi, John! Long time no hear. Could you clarify this a bit? I'm not sure I understand what you're trying to do. "frmQueryFGProcessingFacIDsLineIDs.cbNavigateProfi les" looks like a reference to a combo box, not the name of a form. -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
#6
|
|||
|
|||
On Open
I'm confused. I first placed the code behind the button but the prompt to
enter a cbProfileID appeared and I thought I had it wrong. Also, won't placing this behind the button then limit it's function? I use the button to execute one of any number of forms in a cbox list. I don't need them to all filter to the cbProfileID record. -- www.Marzetti.com "Albert D. Kallal" wrote: I placed the code in the form's On Open property. When I execute the button I'm asked to enter in a parameter for cbProfileID. The debugger points to this line: DoCmd.OpenForm "frmQueryFGProcessingFacIDsLineIDs", , , strWhere ??? Why would we place the above code in the on-open event? Try reading the code before pasting it!!! The docmd.OpenForm will OPEN a ms-access form. So, common sense would seem to indicate that we want to place this code behind the button on our first form. So, remove the code from the forms on-open. We don't need it. further, the "strWhere" code is critical for correct operation, and you failed to post/include this in your question. (did you forget this by accident, or did you not realizes that the strWhere part is the whole key concept to make this work). So, we don't need any code in the forms on-open event. the ONLY place we need code is behind our button on the form. -- Albert D. Kallal (Access MVP) Edmonton, Alberta Canada |
#7
|
|||
|
|||
On Open
"JohnLute" wrote in message
... I'm confused. I first placed the code behind the button but the prompt to enter a cbProfileID appeared and I thought I had it wrong. Also, won't placing this behind the button then limit it's function? I use the button to execute one of any number of forms in a cbox list. I don't need them to all filter to the cbProfileID record. ah..ok - this just means we are making progress!!! Well, we could try and place some code in the form that loads, but what happens when you want to open that form, and NOT filter the data? So, we should likely try to get this to work in the code that OPENS THE form, not the code in the form its self (since, as mentioned, we might want to open that form from several different places in the application - and, perhaps NOT always filter). So, as a goal, lets try and get this to work with your button code: You might have to paste what you have for your button code now, but in that code, simply check for that particular form, and then use our code. if "some form name" = " our form we want to filter" then dim strWhere as string strWhere = "cbProFileID = " & forms!frmFinishedGoods!cbProfileID docmd.Openform "frmQueryFGProcessingFacIdsLindID",,,strWhere else your other code goes here end if Do feell free to post your buttion code that you have now, and we should be able to figire out how to add the abve code.... -- Albert D. Kallal (Access MVP) Edmonton, Alberta Canada |
#8
|
|||
|
|||
On Open
Hi, Dirk! Hope all is well. I was actually searching for your name in
particular today to see if I could find something of yours regarding this. We must be on the same telepathic wavelength. How awesome to have you and Albert - two mighty MVP's helping me out with this! Here is my button code: Private Sub cmdGOrpt_Click() On Error GoTo Err_cmdGOrpt_Click Dim stDocName As String Dim strWhere As String strWhere = "cbProfileID = " & Forms!frmFinishedGoods!cbProfileID DoCmd.OpenForm "frmQueryFGProcessingFacIDsLineIDs", , , strWhere DoCmd.OpenForm Me!cbSelectReportRQ, acNormal Exit_cmdGOrpt_Click: Exit Sub Err_cmdGOrpt_Click: MsgBox Err.Description Resume Exit_cmdGOrpt_Click End Sub I know it's screwy but my brain is mush from dealing with this and some other pretty hairy stuff today. I'm simply trying to open frmQueryFGProcesingFacIDsLineIDs and have cbNavigateProfiles filter to the record from frmFinishedGoods.cbProfileID. Maybe you or Albert can see where I've gone off track? -- www.Marzetti.com "Dirk Goldgar" wrote: "JohnLute" wrote in message I'd like to open a form and filter based on another form's combo box. The form and cbox is: frmFinishedGoods.cbProfileID The form I'd like to open based on the above form's cbox is: frmQueryFGProcessingFacIDsLineIDs.cbNavigateProfil es cbProfileID and cbNavigateProfiles source the same table and field. I'd like cbNavigateProfiles to filter to the record in cbProfileID. How can I code the On Open property of my form to achieve this? Thanks for your help! Hi, John! Long time no hear. Could you clarify this a bit? I'm not sure I understand what you're trying to do. "frmQueryFGProcessingFacIDsLineIDs.cbNavigateProfi les" looks like a reference to a combo box, not the name of a form. -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
#9
|
|||
|
|||
On Open
"JohnLute" wrote in message
Hi, Dirk! Hope all is well. I was actually searching for your name in particular today to see if I could find something of yours regarding this. We must be on the same telepathic wavelength. How awesome to have you and Albert - two mighty MVP's helping me out with this! LOL Maybe Albert's mighty. Here is my button code: Private Sub cmdGOrpt_Click() On Error GoTo Err_cmdGOrpt_Click Dim stDocName As String Dim strWhere As String strWhere = "cbProfileID = " & Forms!frmFinishedGoods!cbProfileID DoCmd.OpenForm "frmQueryFGProcessingFacIDsLineIDs", , , strWhere DoCmd.OpenForm Me!cbSelectReportRQ, acNormal Exit_cmdGOrpt_Click: Exit Sub Err_cmdGOrpt_Click: MsgBox Err.Description Resume Exit_cmdGOrpt_Click End Sub I know it's screwy but my brain is mush from dealing with this and some other pretty hairy stuff today. I'm simply trying to open frmQueryFGProcesingFacIDsLineIDs and have cbNavigateProfiles filter to the record from frmFinishedGoods.cbProfileID. Maybe you or Albert can see where I've gone off track? Bear with me for another question or two. What do you mean when you say you want to "have cbNavigateProfiles filter to the record from frmFinishedGoods.cbProfileID"? Presumably, cbNavigateProfiles is a combo box that shows ProfileIDs. Do you mean that you want this combo box's dropdown list to show only the ProfileID from frmFinishedGoods.cbProfileID? Or do you mean that you want to "automatically select" that profile in cbNavigateProfiles? Or something else? You can certainly stuff the current value of frmFinishedGoods.cbProfileID into frmQueryFGProcessingFacIDsLineIDs.cbNavigateProfil es, if that's what you intend (and if it's in the combo's list). You could do it like this: DoCmd.OpenForm "frmQueryFGProcessingFacIDsLineIDs" Forms!frmQueryFGProcessingFacIDsLineIDs!cbProfileI D = _ Forms!frmFinishedGoods!cbProfileID But I don't know if that's what you have in mind or not. If it is, is anything supposed to happen automatically when you do it? Setting the value this way won't fire the control's AfterUpdate event, so if there's code that's supposed to run when the value is changed, you have to call it yourself. -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
#10
|
|||
|
|||
On Open
"Dirk Goldgar" wrote:
Bear with me for another question or two. What do you mean when you say you want to "have cbNavigateProfiles filter to the record from frmFinishedGoods.cbProfileID"? Presumably, cbNavigateProfiles is a combo box that shows ProfileIDs. Do you mean that you want this combo box's dropdown list to show only the ProfileID from frmFinishedGoods.cbProfileID? Yes! I have a record selected in frmFinishedGoods.cbProfileID and when I click my "Go!" button I want frmQueryFGProcessingFacIDsLineIDs.cbNavigateProfil es to open to that same record. |
|
Thread Tools | |
Display Modes | |
|
|