Results 1 to 14 of 14
  1. #1
    Join Date
    Nov 2005
    Posts
    79

    Unanswered: Report Based on Query

    I have 1 report called "Computer Compilation." I am passing the report title through the OpenArgs function. I have several queries which should be based on a report based on a user's selection. If I have "PC Compilation Report," I need to use the query for PCs. Can anyone help me place the right commands in the code listed below? Your assistance is greatly appreciated.

    If Me.OpenArgs = "PC Compilation Report" Then
    Me!lblAllComputers.Visible = False
    Me!txtTotalComputers.Visible = False
    Me!LblTotalPC.Visible = True
    Me!TxtTotalPC.Visible = True
    Me!LblTotalNotebook.Visible = False
    Me!TxtTotalNotebooks.Visible = False
    Me!lblPrinter.Visible = False
    Me!txtPrinter.Visible = False
    Me!lblHub.Visible = False
    Me!txtHub.Visible = False
    Me!lblRouter.Visible = False
    Me!txtRouter.Visible = False
    Me!lblSwitch.Visible = False
    Me!txtSwitch.Visible = False
    Me!lblSoftware.Visible = False
    Me!txtSoftware.Visible = False
    Me!lblCopier.Visible = False
    Me!txtCopier.Visible = False
    Me!lblBlackberry.Visible = False
    Me!txtBlackberry.Visible = False
    Me!lblCellPhone.Visible = False
    Me!txtCellPhone.Visible = False

    End If

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    Code:
    If Me.OpenArgs = "PC Compilation Report" Then
    Me!lblAllComputers.Visible = False
    '....
    '.....
    Me.Recordsource = "MyPCQuery"
    
    End If
    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Seems like an odd way to do things... what's with all the visible properties?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    An idea you might think worth experimenting with. Rather than hard coding each controls visibility, you could enter "PC" into the tag property of each control to be visible for the PC report and then use code like this:

    Code:
     	Dim ctl As Access.Control
    	For Each ctl In Me.Controls
    	
    		With ctl
    			.Visible = (.Tag = "PC")
    		End With
    		
    	Next ctl
    		
    	Set ctl = Nothing
    You could use the TypeName function (check help) to limit to texboxes only too (for example).
    Just a thought to produce something more scalable.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Nov 2005
    Posts
    79

    Query Recorsource

    When typing in me.recordsource = "MyPCQuery", I get the following:

    Run Time error 2593
    This feature is not available in an MDB.



    I will also work on trying to do the simpler message of visibility controls. Thank you so much for your help.

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Oh miracle - I fear there may be a link from the corrall.

    MyPCQuery = InsertTheNameOfYourPCQueryHereBecauseIDontKnowIt

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  7. #7
    Join Date
    Nov 2005
    Posts
    79

    Sorry

    I did input the name of my query which is (PC query, Blackberry query, etc.)

  8. #8
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Lol - ah, got you. Did you surround them with square brackets:

    Me.Recordsource = "QueryWithNoSpacesLikeThis"
    Me.Recordsource = "[Query With Spaces Like This]"

    A good reason, btw, not to include spaces in object names (incl. field names).
    Testimonial:
    pootle flump
    ur codings are working excelent.

  9. #9
    Join Date
    Nov 2005
    Posts
    79

    Query Report

    All I could do was laugh. lol

    I changed the recordsource, however I get the following message:

    Run Time error 2580, The record source "[Blackberry Query]" specified on this form or report does not exist.

  10. #10
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Ok - try

    Me.Recordsource = "SELECT * FROM [Blackberry Query]"

    If that doesn't work, create a query based on your [Blackberry query] and paste the generated SQL into the VB. Post it here too pls
    Testimonial:
    pootle flump
    ur codings are working excelent.

  11. #11
    Join Date
    Nov 2005
    Posts
    79

    Code for the Blackberry

    Here is my code for the blackberry

    SELECT ComputerInformation.SerialNumber, ComputerInformation.CLN, ComputerInformation.StockNumber, ComputerInformation.Item, ComputerInformation.Type, ComputerInformation.PurchaseDate, ComputerInformation.Weight, ComputerInformation.OperatingSystem, ComputerInformation.ProcessingSpeed, ComputerInformation.SoftwareVersion, ComputerInformation.Memory, ComputerInformation.[On-Board Memory], ComputerInformation.HardDriveSize, ComputerInformation.RemovableHardDrive, ComputerInformation.Wireless, ComputerInformation.DVD, ComputerInformation.CAC, ComputerInformation.DockingStation, ComputerInformation.Division, ComputerInformation.Branch, ComputerInformation.NameID22, ComputerInformation.NameID, ComputerInformation.Comment, ComputerInformation.[Date Retired], Employees.NameID, Employees.Name, Employees.TelephoneNumber
    FROM Employees INNER JOIN ComputerInformation ON Employees.NameID = ComputerInformation.NameID22
    WHERE (((ComputerInformation.Type)="Blackberry"));

  12. #12
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Is your query identicle for the report except for ComputerInformation.Type? If so, I would compell you to use a parameter query instead of a seperate query for every type.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  13. #13
    Join Date
    Nov 2005
    Posts
    79

    Query

    It seems as soon as I get one thing working, another fails. I first tried the filters, but it was missing information, so I went to the queries, and still continue to experience problems. I use one report for about 7 different queries (blackberry, cell phone, pcs, notebook, etc.). A user pushes a button on a form and the click event calls the query, however it is not working. Anything that you can tell me to fix my problem would be greatly appreciated. What would be the best way to run a report, filter or query by type which will provide all of the information needed?

  14. #14
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    I don't know enough about your backend to provide any meaningful answer.

    Put this in a new query and play with it, hopefully it jumpstarts your noodle:

    SELECT ComputerInformation.SerialNumber, ComputerInformation.CLN, ComputerInformation.StockNumber, ComputerInformation.Item, ComputerInformation.Type, ComputerInformation.PurchaseDate, ComputerInformation.Weight, ComputerInformation.OperatingSystem, ComputerInformation.ProcessingSpeed, ComputerInformation.SoftwareVersion, ComputerInformation.Memory, ComputerInformation.[On-Board Memory], ComputerInformation.HardDriveSize, ComputerInformation.RemovableHardDrive, ComputerInformation.Wireless, ComputerInformation.DVD, ComputerInformation.CAC, ComputerInformation.DockingStation, ComputerInformation.Division, ComputerInformation.Branch, ComputerInformation.NameID22, ComputerInformation.NameID, ComputerInformation.Comment, ComputerInformation.[Date Retired], Employees.NameID, Employees.Name, Employees.TelephoneNumber
    FROM Employees INNER JOIN ComputerInformation ON Employees.NameID = ComputerInformation.NameID22
    WHERE (((ComputerInformation.Type)=[Enter Computer Type]));
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •