Results 1 to 3 of 3
  1. #1
    Mercer999 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2019
    Posts
    11

    #Type! Error in Textbox when form control source returns 0 records

    Having issues getting form textbox calc. I've created a form with a control source query. The form has text boxes that are bound to the query fields. I then created another form, and used the prior as a sub form. I then added textbox objects to the parent form and added the subform totals, using NZ() to return zero if null. That does not seem to work, as the textbox remains blank. I also tried to create a recordset in VBA and DCOUNT the records in the query (if =0 then set textbox objects to zero). That returns zero, but can't seem to get it to return anything but zero. (If DCount("*", "qry_PlExpensePaysFormInput_fromUni") = 0 Then...). How can I get these textboxes to show zero so I don't get a #Type! error? The third snapshot shows how it works when records are returned in the underlying query.








    Click image for larger version. 

Name:	Screenshot_1515.jpg 
Views:	15 
Size:	129.0 KB 
ID:	40677Click image for larger version. 

Name:	Screenshot_1616.jpg 
Views:	15 
Size:	84.1 KB 
ID:	40678Click image for larger version. 

Name:	Screenshot_1717.jpg 
Views:	15 
Size:	222.7 KB 
ID:	40679

  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
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Sorry, some pic parts are too small for me. It looks like you've got 2 left parentheses in the blackened expression and 1 right one but that can't be. I believe the type error will be due to a null (and likely cascades), but from where? Since I see nothing obvious (and don't see some of that very well at all) I'd suggest you open in form view and test the values of calculated fields to see what they are. You can either write a sub for this and output each calculated textbox name and value to the immediate window, or you can inquire directly as in
    ?Text74 and hit return to see what you get. If any return null on a new record, your Nz expression isn't working there.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 2
    Last Post: 04-23-2015, 06:10 AM
  2. Replies: 3
    Last Post: 05-15-2014, 01:13 PM
  3. Replies: 12
    Last Post: 12-10-2013, 08:57 PM
  4. form returns records not in record source
    By aussie92 in forum Forms
    Replies: 2
    Last Post: 01-14-2013, 11:23 AM
  5. Replies: 17
    Last Post: 02-08-2012, 10:06 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