Results 1 to 9 of 9
  1. #1
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,038

    Dcount in unbound textbox

    Experts:

    I need some assistance with using "Dcount" (or any other method) for an unbound textbox (on a form).

    Attached sample database includes two (2) sample tables and two (2) sample forms.
    - Table "T01_Billets" includes 10 records
    - Table "T01_StaffMembers" includes 7 records but I do NOT want to count the first record (i.e., "[Vacant]"). So my count for this table should be 6 (not 7).

    Forms:
    - Both forms include an unbound textbox (in orange).
    - For both forms, I want to include the count [i.e., 10 for Billets and 6 (7-1=6) for the Staffmembers]
    - More specifically, for F10_BilletList, I later want to replace the large label "Billet List" with textbox reading: "Billet List (10)"


    - Similarly, for F10_StaffMemberList, I later want to replace the large label Staff Member List" with textbox reading: "Staff Member List (6)"

    I used a DCount but I don't seem to print out anything in the orange boxes on either form. What am I missing? How do I need to modify the orange textboxes to either a) get a total count for all billets or b) get a total count of staff members minus 1 (i.e., all but "[Vacant]")?

    Thanks,
    EEH

    P.S. In my actual database, I have the form linked to queries. I didn't include them in this sample but if necessary, we can add the table/query as the data source.
    Attached Files Attached Files

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I think it's blank because the form isn't displaying any records. If I add a bound textbox and fix the incorrect field name in the DCount(), it displays.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Works with an unbound textbox as well (in the detail section).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,038
    Paul:

    Ok... I put this sample together too quickly. After changing the field to ID, it still doesn't show any records.

    Also, I need this field to be in the form header. If you won't mind, could you please post your version (you indicated it worked for you)?

    Thanks,
    Tom

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Here you go.
    Attached Files Attached Files
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,038
    Paul - first of all... thanks again! I always appreciate your dedicated assistance in this forum. Very much obliged.

    I looked at the form "F10_BilletList" and it certainly outputs a value. Great! Now, when I copied the control/textbox into my actual database, it still didn't show. I ended up copying the form from actual database into this sample database (v02). I even added the query that I'm using in my actual db. Then linked it to both "F10_BilletList" (your version) and "F20_BilletList" (actual db... well still with some changes).

    It's kinda odd that it works in form "F10..." but not in form "F20...". If by any chance you could help me identify what control/property is on F10_BilletList and doesn't exist on F20_BilletList, I'd greatly appreciate the assistance.

    Thanks,
    Tom
    Attached Files Attached Files

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    That form is tied to a query that doesn't have all the fields it's looking for. Is there a reason it's a split form? I've never used one, but if I change it to continuous or single the textbox shows. You don't seem to be using it as a split form, which as I understand it would be datasheet view tied to single form view.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,038
    Paul - thanks for the prompt response. Now that you mention it, yes I need to use it as a "split" form. Basically, it provides me all columns in matrix form.

    That said, is there another way I can get the DCount when the form is in split mode?

    Thanks,
    Tom

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I found that if I delete the first control, which is normally hidden, the textbox is displayed. Somehow the DCount() textbox is tied to that first control. It's almost dinner time here so if that doesn't solve it, I probably won't be back until the morning. Wine and code don't mix well.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Dcount By Multiple Textbox
    By civl_eng in forum Access
    Replies: 13
    Last Post: 07-20-2018, 01:09 AM
  2. Dcount using textbox with like
    By naeemahmad in forum Programming
    Replies: 7
    Last Post: 04-23-2014, 04:14 PM
  3. unbound textbox to bound textbox
    By thescottsman92 in forum Access
    Replies: 3
    Last Post: 08-29-2013, 02:02 AM
  4. Replies: 8
    Last Post: 04-12-2013, 08:59 PM
  5. Replies: 0
    Last Post: 06-11-2009, 09:51 AM

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