Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 9th, 2003, 08:53 AM
Authorized User
 
Join Date: Aug 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Serano,

I just want to add that I put the subform on top of each other within the main form. Is it the problem that cause the related subform did not appear even after I clicked the other button? (only shows the last created subform)
I tried to separate the subform (not on top of each other), as a result they both appear on the main form, without clicking the button. So, on the event click button, do I have to make the subform active or bring it to the front?

Thanks

Cheers,

Fehrer
 
Old September 9th, 2003, 11:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Quote:
quote:Originally posted by Fehrer
I tried to separate the subform (not on top of each other), as a result they both appear on the main form, without clicking the button. So, on the event click button, do I have to make the subform active or bring it to the front?
I don't quite know what you mean. If you put both subforms on the main form showing at the same time, there is no need to make one or the other active. They're both there and one or other will get the focus depending on where you click your mouse. There is also no need to use buttons to activate either since they're both there.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old September 9th, 2003, 06:45 PM
Authorized User
 
Join Date: Aug 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Serrano,

It all works fine now. I misundestood ur point. I only need to create 1 subform control objects within the main form, and set the onClick event accordingly based on the saved subforms, instead of creating many subforms control objects within the main forms for each subforms created (which only display the last created subform). Very much appreciated 4 ur help. Can't thank you enough for ur patience :D!

oh...almost forgot...what do u think about my second problem, in which to populate the listbox with certain reports, instead of all Reports object. I am a bit confused with array.

eg. Supposed the available reports on Reports objects are
1.rpt_A
2.rpt_B
3.rpt_C

The ones that I want to populate within lstReport listbox in frm_CustomersMenu are rpt_A dan rpt_C.
Here is my VBA coding...

Private Sub Form_Load()
    Dim objAO As AccessObject
    Dim objCP As Object
    Dim intStr As String

    intStr = Array("rptMenuList", "rptMenuCbo")

    Set objCP = Application.CurrentProject
    lstReports.RowSourceType = "Value List"

    For Each objAO In objCP.AllReports
        If intStr(objAO.Name, "rpt_A") Then
            Me.lstReports.AddItem (objAO.Name)
        End If
        If intStr(objAO.Name, "rpt_C") Then
            Me.lstReports.AddItem (objAO.Name)
        End If
    Next objAO
End Sub

Private Sub ProcessReport(intAction As Integer)
    If Not IsNull(lstReports) Then
        DoCmd.OpenReport lstReports, intAction
    End If
End Sub

Thanks once again!

Cheers,

Fehrer
 
Old September 10th, 2003, 07:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Quote:
quote:Originally posted by Fehrer
oh...almost forgot...what do u think about my second problem, in which to populate the listbox with certain reports, instead of all Reports object.
Hmmm... well, I'd approach that one of two ways.

[u]Related Naming</u>
Name the forms frmAAA, frmBBB, etc. and then the related reports rptAAA_AAA, rptAAA_BBB, rptBBB_AAA, etc. (change the AAA and BBB, etc. with their real names). Then in your loop you can say something like:
Code:
    If Left(objAO.Name,6) = Left(Me.Name,6) Then
        Me.lstReports.AddItem (objAO.Name)
    End If
    In this way, the loop matches up all the frmAAA with rptAAA and populates the list box.

[u]Create a relational table</u>
If you don't want to name reports similar to their related forms, then create a table with two fields. The first field has the name of the form (strFormName), the second field has the name if its related report (strReportName). Then you can use a select query to populate the list box, for example.
Code:
    Me.lstReports.Rowsource = _
        "Select [strReportName] From tblMyTable Where [strFormName] = '" & _
        Me.Name & "'"



Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old September 10th, 2003, 10:03 AM
Authorized User
 
Join Date: Aug 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Serrano,

Well...well...well. It's all works extraordinary fine. Many many thanks to u, especially 4 ur patience in guiding and assisting me. I would like to nominate u to be my advisors if u don't mind :D, and Bob Beddel as well. My application would not be great (personal opinion) without 2 of u guys. May God bless u.

Cheers,

Fehrer





Similar Threads
Thread Thread Starter Forum Replies Last Post
parsing form data from frame to other frame audio-catalyst Classic ASP Basics 5 January 3rd, 2006 02:57 PM
Switchboard ?s JeffGirard Access 1 September 15th, 2005 02:52 AM
Call right frame Page_Load event from left frame. ochanarachel Classic ASP Basics 0 January 28th, 2005 05:13 AM
Printing Report in Bottom Frame itHighway Classic ASP Basics 2 December 29th, 2004 08:31 PM
How to use use ListBox in SQL Report abhiinbwir ADO.NET 0 July 13th, 2004 06:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.