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??
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.
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?