Results 1 to 6 of 6
  1. #1
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Design View (A2000 SR1)

    On building my database, I need to continously change designs of various forms.
    I usually right click to design view and have to close other forms as they are nested to access the form i have selected to alter the design.
    I was wondering if it's possible to assign an autokey to open the current form in design view and bring it to the front of every other loaded form.
    Just a thought, which would be extremely useful.
    Thanks in anticipation.
    Regards
    Dave

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Design View (A2000 SR1)

    As you know, I'm still using Access 97, so I don't know if the following will do exactly what you want in Access 2000.

    You might create a function in a standard module:

    Function OpenFormInDesignView()
    Dim strFormName As String
    If Application.CurrentObjectType = acForm Then
    strFormName = Application.CurrentObjectName
    DoCmd.OpenForm strFormName, acDesign
    Forms(strFormName).SetFocus
    End If
    End Function

    Next, create a new macro. Make sure macro names are displayed. Set the macro name to the code for the hotkey you want to use. Possibilities:
    ^L means Ctrl+L (L can be any letter or digit)
    {F1} means F1 (F1 can be any function key)
    ^{F1} means Ctrl+F1 (F1 can be any function key)
    +{F1} means Shift+F1 (F1 can be any function key)

    Set the action of the macro to RunCode. In the Function name box, enter

    OpenFormInDesignView()

    The macro should work if you have selected a form in the database window, and also if you have a form open in form or datasheet view. I can't test how it acts on nested forms in Access 2000.

  3. #3
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Design View (A2000 SR1)

    Well, I bet you've even suprised your self here.
    The code works fine but doesn't bring the form back to the front. I wonder if adding a line to close all other forms would do the trick.
    What do you think ?
    Sorry for taxing your brain so much just lately.
    You know what they say, " An active mind keeps you from getting older."
    All the very best.
    Dave

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Design View (A2000 SR1)

    Hi Dave,

    Try this:

    Function OpenFormInDesignView()
    Dim strFormName As String
    Dim i As Long
    If Application.CurrentObjectType = acForm Then
    strFormName = Application.CurrentObjectName
    DoCmd.OpenForm strFormName, acDesign
    For i = Forms.Count - 1 To 0 Step -1
    If Forms(i).Name <> strFormName Then
    DoCmd.Close acForm, Forms(i).Name
    End If
    Next i
    Forms(strFormName).SetFocus
    End If
    End Function

    If that doesn't work, I hope that another Lounger who has Access 2000 will jump in.

  5. #5
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Design View (A2000 SR1)

    Perfect.
    This will save me endless mouse operations.
    I'm sure others will also benefit from this useful utility.
    Thanks once again
    Dave

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Design View (A2000 SR1)

    You can also use DoCmd.SelectObject to shift the focus to the form. However, in A2k, you can also set the forms to allow access to the property sheet in all views. That might be an alternative to switching into design view, depending on what you need to do to the form.
    Charlotte

Posting Permissions

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