+ Reply to Thread
Results 1 to 5 of 5

Next page - Activate/Deactivate controls based on answers (access forms)

  1. #1
    Registered User
    Join Date
    05-01-2012
    Location
    Greece
    MS-Off Ver
    Excel 2010
    Posts
    52

    Next page - Activate/Deactivate controls based on answers (access forms)

    Hello everybody.

    I am dealing with some problems I can't solve (please take in mind that I started reading about access less than a week ago)

    The situation:

    I have made a simple data form for data entry. The form name is Pet - Form and the related table is Pet. The form consists of 6 tabs with captions

    "ΦΟΡΜΑ ΚΑΤΑΓΡΑΦΗΣ ΜΥΣΤΙΚΟΥ ΕΠΙΣΚΕΠΤΗ"
    "ΤΥΠΟΣ - ΜΕΓΕΘΟΣ ΚΑΤΑΣΤΗΜΑΤΟΣ"
    "ΕΞΩΤΕΡΙΚΟ ΚΑΤΑΣΤΗΜΑΤΟΣ"
    "ΕΣΩΤΕΡΙΚΟ ΚΑΤΑΣΤΗΜΑΤΟΣ"
    "ΔΙΑΚΙΝΗΣΗ ΠΡΟΪΟΝΤΩΝ"
    "ΣΕΝΑΡΙΟ - ΣΧΟΛΙΑ".

    The corresponding objects are

    Page437
    Page436
    Page462
    Page538
    Page576
    Page602.

    The last control of each page is either a text box or a combo box.

    The problems:
    1) When the user enters a value on the last control of each page to be redirected to the next (if he enters a value on the control of the last page to be redirected to the first)
    2) The first control of the second page is a combo box (object "Α Τύπος Καταστήματος" with label caption "Τύπος Καταστήματος") with a list of two selections

    "1 Αποκλειστικά καταστήματα Pet shops"
    "2 Μικτό κατάστημα"

    with the numbers being stored at the database.

    The second control is a text box (object "Αtext Τύπος Καταστήματος" with label caption "Περιγραφή άλλης δραστηριότητας") which should be initialy inactive and get active when "2 Μικτό κατάστημα" is selected.

    Please note that maybe I don't use the correct terminology to describe things as am a beginner and, if possible, keep the language in the corresponding level.

    Thank you very much in advance.

    I also tried the code suggested here (http://www.techonthenet.com/access/f...ol_nextrec.php) but I get run tine error '424' object required.
    Last edited by akotronis; 05-21-2013 at 09:13 AM.

  2. #2
    Forum Contributor
    Join Date
    05-05-2009
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010 and 365
    Posts
    113

    Re: Next page - Activate/Deactivate controls based on answers (access forms)

    akotronis,


    I don't think what you are trying to do would be very difficult but it's hard to understand exactly what the issue is.

    Do you have knowledge regarding vba and event procedures? If you do then it should be no problem. If you don't then it will be trickier but I still don't think it would be too difficult. I am new to access myself but have a fairly good understanding of vba and event procedures.



    To sum up what you need to do.

    1 - Add code to the event procedure in the field last field of the first page. This code will activate the next page and set the focus on the combo box.

    2 - Add code to the change event procedure of the combo box. Actually probably the before update or after update. These are located in the event tab of the properties window. Assuming 2010 version.


    You might be able to do with macros (not vba) but I don't know if you can enable / disable controls with macros.


    Edit:

    Step 1 - make sure you know where to put the code.


    In design view, select the last field on page 1.

    Then select the event tab in the properties sheet (probably far right, if not visible, right click form and select properties.

    Then select the on key down field and click the button on the right (...)

    Select cold builder and paste the following code into the procedure.


    Please Login or Register  to view this content.

    Go into form view, go to that field and press the tab key. You should get a popup that said you hit that key. It should only trigger if you are in that field.


    If that works then all you need to do is replace the MsgBox statement with the code required to activate the next page and set the focus to the first field.


    And repeat for each page.
    Last edited by Cyclops; 05-22-2013 at 11:58 AM.

  3. #3
    Registered User
    Join Date
    05-01-2012
    Location
    Greece
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Next page - Activate/Deactivate controls based on answers (access forms)

    Hello again. At first thanks for your response. I have managed to solve the hide-unhide issue based on values entered and the Keycode = 9 works as well.

    An issue remains however.

    I have entered a next page button as last control on each page and entered a go to next page command using vba as a on click event, which works just fine. Now the bad thing is:

    If the user hits tab or enter when the next page button is on focus, he/she goes to the next record which is something I don't want, as he/she may not realize it and continue entering values as if he/she was in the previous record.

    I tried entering on key press event
    Please Login or Register  to view this content.
    but it just ignores it... Any ideas on why this may happen?

    Thanks again
    Last edited by akotronis; 05-24-2013 at 04:15 PM.

  4. #4
    Forum Contributor
    Join Date
    05-05-2009
    Location
    Wisconsin
    MS-Off Ver
    Excel 2010 and 365
    Posts
    113

    Re: Next page - Activate/Deactivate controls based on answers (access forms)

    Maybe if you set the tab stop property of the button to no.

  5. #5
    Registered User
    Join Date
    05-01-2012
    Location
    Greece
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Next page - Activate/Deactivate controls based on answers (access forms)

    I have resolved this issue, It was the Cycle "current record" option of the form's property sheet. Thank for the response!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1