Results 1 to 4 of 4
  1. #1
    jfrogg is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2014
    Posts
    9

    Run-time error '424'


    Not looking for a free ride here or anything, I'm just a bit lost as to what I'm doing wrong. My assignment says I need to make the buttons in frmMainMenu call the caption of each button from the table MainMenu. I think I have the basic guts of the programming correct, but I keep getting a run-time error and I'm not sure what is causing it. I'm not sure if I got the ids wrong or what is causing the problem. I'm not looking for anyone to just paste the complete solution here, but a few hints would be much appreciated!
    Attached Files Attached Files

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Try invoking the Code Builder. I did not download your db.Use the OnOpenEvent for example and simply make it look like this.
    Option Compare Database
    Option Explicit
    HTH

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    For starter, can't have procedure declaration lines one after the other. Each declaration must have an End line and each pair can't be between another pair. One of these declaration lines must be removed:

    Private Sub Detail_Click()
    Private Sub Form_Open(Cancel As Integer)
    ...
    End Sub

    Code in that procedure attempts to set caption property of several things, example: rptCDList. There is no button on the form by that name. Why would you need code to set button caption? Just set the Caption property in the form design. The only thing I can find by that name is a report. Name the buttons like: btnCDList.

    Also, the DLookup() code is looking for a field named ReportID in MainMenu table which doesn't exist. The field name is just ID.

    I think the assignment is to construct code that will open form or report. However, the names listed in the Form field of MainMenu table are not the actual form or report names. The actual form and report names have frm and rpt as prefix and no spaces. Better remove the spaces. The appropriate prefix can be concatenated in code.

    Something of an odd assignment. Looks rather like VBA code to emulate a switchboard form which uses macro code and a table. I never did like the switchboard construct. Why not just program the buttons to open appropriate form or report? Why is the table needed?

    '' This code defines the CD List Button
    Private Sub btnCDList_Click()
    DoCmd.OpenReport "rptCDList", acViewReport
    End Sub

    How did you even generate the Click procedures? There are no buttons on the form with names referenced in the procedure declarations.

    As burrina notes, every code module should begin with:
    Option Compare Database
    Option Explicit

    Then you should run Debug > Compile. See link at bottom of my post for debugging guidelines.
    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.

  4. #4
    jfrogg is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2014
    Posts
    9
    Wow, I was WAAAAYYYYYY off!! Just another case of my trying my best to turn a simple problem into an incredibly complicated mess. Thanks for pointing me in the right direction!

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

Similar Threads

  1. Replies: 11
    Last Post: 05-01-2014, 11:56 AM
  2. Replies: 3
    Last Post: 01-23-2014, 07:49 AM
  3. Replies: 3
    Last Post: 03-05-2013, 11:17 AM
  4. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  5. Replies: 6
    Last Post: 05-30-2012, 12:32 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