Results 1 to 2 of 2
  1. #1
    TOPSie is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    108

    Subform DataSheet ignoring(?) function?????

    I have a form:-
    Click image for larger version. 

Name:	Clipboard23.jpg 
Views:	18 
Size:	34.9 KB 
ID:	50862

    Which is a Form with a with a subform – here is the design view of the subform

    Click image for larger version. 

Name:	Clipboard24.jpg 
Views:	17 
Size:	20.9 KB 
ID:	50863

    Which is a Datasheet
    It worked well with the first 7 columns each with a single field as Control Source.
    I have added an eight column which is far more complex. It uses a public function (in VBA) to calculate an 8 week average based on the vehicle and ProductId from the same table which is the main source of the (sub)form
    The Control source of the 8th column is
    Code:
     =gcAverageEggReturns(GetEggVehicle(),[ProductID],GetEggDate())



    I have put a break point in the function and I know it is obeyed when the form loads and I can see it returns non-zero results.
    But when I run the form normally the eight column is always filled with zero.
    At some point I did observe the form load quite slowly and the first 7 columns appeared immediately but the 8th took longer to load as if it did some sort of repaint and lost the function results in some way

    Any ideas what is going on????

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Put the function call as a calculated field in a query based on the source table for the form.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

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

Similar Threads

  1. Replies: 10
    Last Post: 05-01-2017, 06:11 AM
  2. Replies: 1
    Last Post: 12-05-2016, 02:23 PM
  3. Replies: 3
    Last Post: 08-18-2013, 09:14 PM
  4. Replies: 1
    Last Post: 07-22-2013, 12:00 PM
  5. Replies: 8
    Last Post: 08-26-2012, 11:11 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