Jumat, 21 Oktober 2016

Re: [MS_AccessPros] BOM Drill Down Subform



I figured it out. This works in the open event:

 Dim txtPart As String
    If IsNull(Me.OpenArgs) Then
        Exit Sub
        txtPart = Me.OpenArgs
        If Len(txtPart) > 0 Then
            Me.cboPart = Me.OpenArgs

        End If
    End If

Thanks for your help today. I learned some new things. :-)


---In MS_Access_Professionals@yahoogroups.com, <winberry.doyce@...> wrote :


You are right on target! That is just what it needed. Now that works. Perhaps you could help me with another bug. I want to open this form from another form where I look up a trailer and double click the trailer's BOM part number. So I put this code in the double click event of the trailer look up form:

 'open form frmBOMLU and display BOM components
    Dim txtPart As String
    txtPart = Me.BOM
    Debug.Print txtPart
    DoCmd.OpenForm "frmBOMLU", acNormal, , , acFormReadOnly, , txtPart

This seems to work. it is trying to open the form and debug.print shows me the correct Part. However, here is the code I put in the open event of the secondary form:

Dim txtPart As String
    Debug.Print Forms!frmVINInquiry.OpenArgs
    txtPart = Forms!frmVINInquiry.OpenArgs
    If Len(txtPart) > 0 Then
    DoCmd.GoToControl "cboPart"
    DoCmd.FindRecord txtPart, , True, , True, , True
    End If

It errors on the line txtPart = Forms!frmVINInquiry.OpenArgs with "Invalid Use of Null". The debug.print on the line above show Null. So It is not picking up the value from OpenArgs but I don't know why.


---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :


What code do you have in the After Update event of the combo on the outer form?  I bet it's that code that moves the outer form to the selected part.  You need to be able to call that code from your double-click code in the subform.  You can do that by making the event procedure Public - then you can call it as a method of the outer form.  Like this:


John Viescas, author
Effective SQL
SQL Queries for Mere Mortals
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Access Applications

On Oct 21, 2016, at 16:51, winberry.doyce@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

Hello Pros,

I need help on this one. I have a form that I want to use to drill down into a bill of material to look up parts. The parent form has a combo box that looks up a part from the part master table. There is a subform that shows the components of the part in the combo box. I want to be able to doubleclick on one of the components part numbers and have it move to the combo box on the parent form and display the components of that subassembly. The parent form is working fine. Whatever I select from the combo box, the components display. I put code in the doubleclick event of the components in the subform to update the combo box in the parent form and requery. However, when the form is requeried, it always displays the first record in the part master instead of the part in the combo box. What have I missed? Here is the code in the doubleclick event of the component n the subform:

'reset form to show components of part that is double clicked.
    Dim txtPart
    txtPart = Me.COMPRT_02
    Me.Parent!cboPart = txtPart
    Debug.Print Me.Parent!cboPart



Posted by: winberry.doyce@con-way.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.



Tidak ada komentar:

Posting Komentar