Results 1 to 9 of 9
  1. #1
    Jo22 is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Location
    Alberta, Canada
    Posts
    21

    Move Form Fields Up or Down

    Hello,



    I have a form with the following text boxes listed in a row:

    Feature1
    Feature2
    Feature3
    Feature4

    I would like the visibility of any of these fields to be false if they are Null. I would also like to close the space between any field that is not visible. I can get the visibility to work, but I do not know how to compact the list. Eg. If Feature2 and Feature3 are Null, move Feature 4 up.

    I am using the following code in the OnCurrent Event:

    If IsNull(Me.Feature1) Then
    Me.Feature1.Visible = False

    Else

    Me.Feature1.Visible = True

    End If

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You can use a list box if you do not need entry into those fields.

  3. #3
    Jo22 is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Location
    Alberta, Canada
    Posts
    21
    Thanks Aytee but a list box is not an option in this situation.

  4. #4
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Subform?

    You are not giving a lot of information here!

  5. #5
    Jo22 is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Location
    Alberta, Canada
    Posts
    21
    Sorry Aytee! I'll try to give you more details.

    The form [PriceCalculation] is a separate form I am creating which is called from a command button on my main form.

    It's purpose is to calculate the total price of a product, which gathers the appropriate information from several other tables. Here is an outline of the form: (The tabs are not working to well so spacing doesn't look good here)

    Base price $_________

    Feature1 $________
    Feature2 $________
    Feature3 $________
    Feature4 $________

    Feature Total $__________

    Installation:

    Mileage $_______
    Per Unit 5 @ $_______
    Installation Total $__________

    Subtotal $__________
    Less: Discount $__________
    TOTAL $__________

    Some of these features will have a null value. If so I would like to hide the whole line and move the rest of the form up. What is the best way to achieve this? Could I possibly use a code to delete the whole line if a particular [Feature#] were null?

    Thanks.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Even though a control is not visible it still takes up space on the form. The only way to 'compress' is to physically reposition all the controls listed below. This repositioning can be done in code but is a real headache to program (been there, done it).

    Why doing this data manipulation in a form, why not a report?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You could design a subform in the manner described above with the Base Price in the header, the Features as continuous lines in the detail, and the rest in the footer. You could make in look like any other text by removing borders, etc, so that it wouldn't look like a subform to the users. Again, I am assuming that this is display only, that the data already exists and that no data entry is required.

  8. #8
    Jo22 is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Location
    Alberta, Canada
    Posts
    21
    I have to admit this is quite an ambitious project for an amature such as myself. However, with lots of study and some great advice from individuals on this forum I am amazed at how far this project has come along. The learning curve is steep but well worth the effort.

    Since the information I was trying to put on a form does not necessarily have to be editable, I agree with you June7, that a report may be the simplest solution here.

    Aytee has offered an alternate solution which I find very interesting. I am going to try both today. Even if the report is the simplest solution, the subform idea may be quite useful for another part of my project.

    I will post back later today with the final solution.

    Thanks,
    Jo

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    What I said about a form also applies to a report. Same for Aytee's suggestion. It's just that some data manipulation can be easier in a report and if you want to print the info, a report is better method.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Move from form to form with same record
    By soulice in forum Forms
    Replies: 14
    Last Post: 01-14-2012, 01:15 AM
  2. Cant move fields around on a form
    By byterbit in forum Forms
    Replies: 3
    Last Post: 02-20-2011, 06:41 PM
  3. Move fields to the right in a report
    By degras in forum Reports
    Replies: 1
    Last Post: 01-20-2011, 08:40 AM
  4. Replies: 1
    Last Post: 08-09-2010, 03:59 PM
  5. move from Main form into sub form
    By miziri in forum Forms
    Replies: 2
    Last Post: 11-28-2009, 06:04 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums