1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Access: Hide an already open window with VB or Macro

Discussion in 'Business Applications' started by firestormer, Apr 6, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. firestormer

    firestormer Thread Starter

    Joined:
    Sep 16, 2005
    Messages:
    1,254
    I need to hide a window thats already open using some VB or a macro.

    Anyone know how?

    Thanks
     
  2. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    Which type of window?
    Is it a Form/Report or an actual Access system window?
     
  3. firestormer

    firestormer Thread Starter

    Joined:
    Sep 16, 2005
    Messages:
    1,254
    HI OBP i thought it would be you who'd reply.

    Yup its just a form in access.
    I know how to hide a form from open using a macro but the form needs to be visable at first then hide.

    Is there any DoMenuItem VB to do the Window > Hide > [Form Name] ?


    Also on a completely different topic do you know how to get access to select a specific item in a list box on a form?

    Thanks
     
  4. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    firestormer, you can use the direct
    FormName.Visible = False
    to hide a form, where FormName is the name of your form. It depends on where you are trying to hide it from.
    The second question I am not clear on, does the user select an item and you want to know what it is?
    Or do you want to run through the List "Source" and match to a value?
     
  5. firestormer

    firestormer Thread Starter

    Joined:
    Sep 16, 2005
    Messages:
    1,254
    Great the code works Thanks

    Second Question.

    The list box is on a form and is set up so that when an item on the list box is selected the form goes to the appropriote record.

    The problem is if the user uses the mouse wheel, keyboard ir navigation buttons to change record. When this happens the item selected on the list box remains the same thus possible confusing the user.
     
  6. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    This sounds like the List Box is Unbound?
     
  7. firestormer

    firestormer Thread Starter

    Joined:
    Sep 16, 2005
    Messages:
    1,254
    Sorry for the delay, i didnt get an email that you'd posted.

    The list box is unbound.
     
  8. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    For the list box to retain a prior selection it has to be "bound" to a Field in the form's underlying table or query, otherwise there is no way for Access to remember what selection you have made.
     
  9. firestormer

    firestormer Thread Starter

    Joined:
    Sep 16, 2005
    Messages:
    1,254
    If its bound then when an item on the list is selected the record will be altered to that item on the list.

    This list is a list of the records in that form. By selecting the record form the list the form goes to that record. BUT when the record in view is changed by other means (keyboard navigation buttons) the list dosnt reflect that move.

    I have attatched the relevent sections of the DB.
     

    Attached Files:

    • db1.zip
      File size:
      212.3 KB
      Views:
      291
  10. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    Is this what you want it to do?
     

    Attached Files:

    • db1.zip
      File size:
      256.6 KB
      Views:
      409
  11. firestormer

    firestormer Thread Starter

    Joined:
    Sep 16, 2005
    Messages:
    1,254
    Yeah, what did you do?
     
  12. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    Added a line of VB code to the On Current event procedure.
     
  13. firestormer

    firestormer Thread Starter

    Joined:
    Sep 16, 2005
    Messages:
    1,254
    GREAT, thanks.

    This project is nearly reaching an end THANK GOD!

    if just got to make some final tweaks and thats it. :)

    Thanks for all your help.
     
  14. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    firestormer, my pleasure, see you on the next one. :D
     
  15. firestormer

    firestormer Thread Starter

    Joined:
    Sep 16, 2005
    Messages:
    1,254
    Im back (already), I realy ought to buy a book on VB and Access.

    Say i have a form (From1) it has fields A and B where A is the primary key.
    I have another form (Form2) it has fields B and C where B is the primary key.

    I want to create a button in Form1 which when clicked will open Form2 and go to the reocrd where B in Form 2 is the same as the B shown in Form1.

    What VB will i need? I figure the VB will need to go in Form1 and this is what i have so far:

    Private Sub Command1_Click()
    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Form2"
    DoCmd.Minimize

    DoCmd.OpenForm stDocName, , , stLinkCriteria
    DoCmd.GoToRecord

    After that im stuck
     
  16. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/558815