Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2006
    Location
    Essex
    Posts
    5

    Unanswered: VBA - Next Record in Unrelated Subform

    Okay - so this is probably an unusual use for MS-Access (2000), but I'm making a noticeboard application which displays event times etc. I've added a Notices subform (which hides and displays on a counter) which works fine until I need to cycle between notices. The Main form displays the next event, Subform1 displays a list of forthcoming events and subform2 is for notices. There is no relation (and I cannot see that there ever will be a relation) between the data in the tables for the main form and the data in the table for subform 2.

    The code controlling the main form is built on the following basis (this is very top level)

    ' Assume change every 20 seconds
    Select Case Timer
    Case Timer between 0 and 20 seconds
    ' Only data on Main form is visible
    Hide Subform1
    Hide Subform2
    Case Timer between 21 and 40 seconds
    ' Subform 1 obscures data on main form
    Show Sumform1
    Hide Subform2
    Case Timer between 31 and 60 seconds
    ' Subform 2 obscures data on main form
    Hide Subform1
    Show Subform2
    Endcase
    Reset Counter
    Loop

    I've got code to skip the display of Subform2 if there are no notices to be shown. The problem comes when there is more than one notice to be displayed. (subform2 should only display one record at a time). What I'd like to achieve is something along the following lines

    Case Timer between 31 and 60 seconds
    ' Subform 2 obscures data on main form
    Hide Subform1
    if the notices are at end of file
    go to first record on subform2
    else
    go to the next record on subform2
    endif
    Show Subform2

    Please can the forum give me the best method for selecting the next record on the subform and should that code be in the subform or in the main form??

    Many thanks
    Adrian

  2. #2
    Join Date
    Feb 2006
    Posts
    56
    Hi Adrian,

    First of all, welcome to the forum. I found the following out on Microsoft's knowledgebase, which is what you will need to do to synchronize the forms. You will be able to modify this logic to incorporate your other requirments above. If you run into any issues, let me know and I will be happy to help.

    the link:

    http://support.microsoft.com/kb/149940/en-us


    Thanks,

    John

  3. #3
    Join Date
    Mar 2006
    Location
    Essex
    Posts
    5

    Red face Still Can't work it..

    Thanks for the link, John. I've had a look at that article and around related Microsoft articles, but I'm still having problems getting this to work. I've copied the pertinent parts of the database to a smaller file and have attached it. Where am I going wrong, please?

    Many thanks

    Kind regards
    Adrian
    Attached Files Attached Files
    Last edited by AdeLang; 03-14-06 at 17:58.

  4. #4
    Join Date
    Mar 2006
    Location
    Essex
    Posts
    5

    Thumbs up Solved It!

    After a lot more searching and some more code changes I've managed to solve the problem. Working version attached in Zip
    Attached Files Attached Files

Posting Permissions

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