Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Mar 2006
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to rearrange controls in a form (Access 2000)

    Can i use the commands Move left in a form? I have several controls in my form and i want to rearrange the positions of the controls depending on the command.I want not only to make some of the controls invisible, but also to move left some of them in order to have a better desing.In my example, i have the following controls in the form:
    calls.day. client contact invoice order offer
    When i click the command button Offers, i need the following arrangement:
    calls.day contact offer
    In order to achieve that i need to move the control "client" next to "calls.day" and the control "offer" next to to contact.The other controls should be made invisible.Also i need to show only those rows where there are offers, i.e. the offes should be greater than 0.
    For the command invoices i need the following arrangement :
    calls.day client invoice
    Which are the best commands to move the controls ?

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

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

    Re: How to rearrange controls in a form (Access 2000)

    It would be much easier to create two queries and two forms. You wouldn't have to change the layout of the form on the fly.

    Here is code to change the layout. You must add code to change the record source yourself.
    Note: I changed the names of the controls, since my Visual Basic Editor cannot work with Cyrillic characters.

    Private Sub Command26_Click()
    Me.CustomerID.Visible = False
    Me.Label21.Visible = False
    Me.ClientID.Visible = True
    Me.ClientID.Left = Me.Day.Left + Me.Day.Width + 18
    Me.Label22.Visible = True
    Me.Label22.Left = Me.Day.Left + Me.Day.Width + 18
    Me.invoice.Visible = False
    Me.Label23.Visible = False
    Me.order.Visible = False
    Me.Label24.Visible = False
    Me.offer.Visible = True
    Me.offer.Left = Me.ClientID.Left + Me.ClientID.Width + 18
    Me.Label25.Visible = True
    Me.Label25.Left = Me.ClientID.Left + Me.ClientID.Width + 18
    End Sub

    Private Sub Command27_Click()
    Me.CustomerID.Visible = True
    Me.CustomerID.Left = Me.Day.Left + Me.Day.Width + 18
    Me.Label21.Visible = True
    Me.Label21.Left = Me.Day.Left + Me.Day.Width + 18
    Me.ClientID.Visible = False
    Me.Label22.Visible = False
    Me.invoice.Visible = True
    Me.invoice.Left = Me.CustomerID.Left + Me.CustomerID.Width + 18
    Me.Label23.Visible = True
    Me.Label23.Left = Me.CustomerID.Left + Me.CustomerID.Width + 18
    Me.order.Visible = False
    Me.Label24.Visible = False
    Me.offer.Visible = False
    Me.Label25.Visible = False
    End Sub

  4. #3
    2 Star Lounger
    Join Date
    Mar 2006
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to rearrange controls in a form (Access 2000)

    Thank very much for the nice design i have with this convenient method.It works fine.I do not know why, but when i select offers, the name in the clientid disappears.Otherwise it is shown in the form.
    I am sending you the example.First of all, before clicking on the button Offers, i have to select from the option box.Otherwise i get errors.When i select the first option and then click on offer,the arranegment is fine, but the names of the clients are not seen anymore.What may be the reason for that?

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

    Re: How to rearrange controls in a form (Access 2000)

    I'm sorry, the database you attached doesn't work for me since it uses Cyrillic characters.

  6. #5
    2 Star Lounger
    Join Date
    Mar 2006
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to rearrange controls in a form (Access 2000)

    I am sorry for the omission.Please find the attachement improved in English.Please disregard the error with the customer, i simply omitted to inclde the table customer in order to be more clear.You can see there are three offers:603,602 and 600.If i click on the first option and thne on the button offers, one could see the numbers of the offers indeed but not the names of the contacts.

    Kind regards

  7. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 15 Times in 15 Posts

    Re: How to rearrange controls in a form (Access 2000)

    In the On Click code of the command buttons, you set the record source of the form to an SQL statement that doesn't include the contacy field:

    SQL = "SELECT Calls.day, Calls.customer, Calls.offer, Calls.employee, Calls.afid " & _
    " FROM Calls "

    You should include all fields you need. The easiest way is

    SQL = "SELECT * FROM Calls "

  8. #7
    2 Star Lounger
    Join Date
    Mar 2006
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to rearrange controls in a form (Access 2000)

    yeas it all OK now and i thank you so much for all that.My form is perfect and runs without any problems at all. Thank you !

Posting Permissions

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