Results 1 to 14 of 14
  1. #1
    BSJoJaMAx4's Avatar
    BSJoJaMAx4 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    48

    Main menu

    I have a table called exiting staff data and a field called Follow up required. I want to count the number of Yes entries and display it on the main menu. Have tried


    Code:
    =Count([Exiting Staff Data].[Follow up required]="Yes")
    and using dcount but keep getting error messages. Any thoughts?

  2. #2
    BSJoJaMAx4's Avatar
    BSJoJaMAx4 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    48
    Also, on the same menu, I have a quick find box for previous records. It uses a combo box to select all current ID records in the database. When i find the one I want (or type ahead) I get a 2465 error code.
    Code:
    Private Sub Quick_Record_Click()DoCmd.OpenForm "Booking Master Data", acNormal, , "[ID]=" & Nz([ID], 0)
    End Sub

  3. #3
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Hi,

    to use DCount: (assuming the field [Follow up is required] is a Yes/No field)

    Code:
    =DCount("[Fieldname PK of the table]","Existing Staff Data", "[Follow up required]=0")
    kind regards
    NG

  4. #4
    JamesDeckert is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    Something else you can try
    =-sum([Exiting Staff Data].[Follow up required])
    yes in a table is equal to -1, no is 0 so if you simply add the column and reverse the sign you should have a count of all yes'
    or you can do DCount but I think it could be formatted as
    =DCount("*","Exiting Staff Data","[Follow up required]=true")
    NoellaG's would work also if you correct the table name spelling and check for -1 (true) instead of 0 (false)

  5. #5
    BSJoJaMAx4's Avatar
    BSJoJaMAx4 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    48
    Hi James
    Code:
    =DCount("*","Exiting Staff Data","[Follow up required]=true")
    worked

  6. #6
    BSJoJaMAx4's Avatar
    BSJoJaMAx4 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    48
    Hi NoellaG - are you answering the first or second issue I had?

  7. #7
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Hi,

    that was an answer to the first issue. I think the second issue has to do with the naming of the controls:
    You must be sure that in the second part of the statement you refer to an existing control on the open form.
    Code:
    Private Sub Quick_Record_Click()
          DoCmd.OpenForm "Booking Master Data", acNormal, , "[ID]=" & Nz(Me.[ID], 0)
    End Sub
    This would work if the control name on the form is [ID]

    kind regards
    NG

  8. #8
    BSJoJaMAx4's Avatar
    BSJoJaMAx4 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    48
    Hi NoellaG

    Sorry but I got my form infom incorrect. Correct code is
    Code:
    Private Sub Quick_Record_Click()DoCmd.OpenForm "Fm-Booking Master Data", acNormal, , "[ID]=" & Nz([ID], 0)
    End Sub
    But Im still getting the same error when I select the record ID. Control Source is blank, Row source is Booking Master Data (which is where the info is stored). The label is showing up as unbound.

  9. #9
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Hi,

    put a text box on your form and bind it to the field [ID]. If you don't want it to show up on your form, set the 'Visible' property on false.
    Refer to this textbox in the third part of your expression:

    Code:
    Private Sub Quick_Record_Click() 
    DoCmd.OpenForm "Fm-Booking Master Data", acNormal, , "[ID]=" & Nz([Name of the textbox control on your form], 0)
    End Sub
    Tip: try not to use spaces in your object names, you can replace them with underscores.

    kr
    NG

  10. #10
    BSJoJaMAx4's Avatar
    BSJoJaMAx4 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    48
    The only items I can see in control source is linked to the switchboard menu options. Is that right?

  11. #11
    BSJoJaMAx4's Avatar
    BSJoJaMAx4 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    48
    The only items I can see in control source is linked to the switchboard menu options. Is that right?

  12. #12
    BSJoJaMAx4's Avatar
    BSJoJaMAx4 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    48
    @James - I have had to change the record to a text field. I have changed the code to
    Code:
    =DCount("*","Exiting Staff Data",[Followuprequired]="Yes")
    but it returns an error?

  13. #13
    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
    =DCount("*","[Exiting Staff Data]","[Followuprequired]='Yes'")
    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.

  14. #14
    BSJoJaMAx4's Avatar
    BSJoJaMAx4 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    48
    Thanks June - that got it to work.

    Thanks James for your help as well

    Happy Sunday all

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

Similar Threads

  1. Display 5 last records on a main menu
    By BSJoJaMAx4 in forum Access
    Replies: 8
    Last Post: 08-24-2015, 03:08 AM
  2. creating a main menu page
    By DianneBeck in forum Access
    Replies: 1
    Last Post: 06-02-2015, 08:05 PM
  3. Main menu page
    By DianneBeck in forum Misc
    Replies: 3
    Last Post: 06-02-2015, 07:00 PM
  4. Main Menu
    By MarkV in forum Access
    Replies: 3
    Last Post: 12-07-2014, 09:57 PM
  5. Main Menu and Sub Menus
    By REngelbr in forum Access
    Replies: 0
    Last Post: 08-25-2009, 03:51 PM

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