Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by Lou_Reed View Post
    I thought it was something like that, what with the constant changing of my VBA code and db design. However, I need to ask how you found it. I tried yesterday to do so and I could not.

    What procedure did you use? Please understand that this is not code that I wrote. It is code written by someone else that I tried to integrate
    into my db.

    I just need to know the debugging methods that you used to find the answer you gave me. I could
    walk through the code using the debugger, but that was about it.



    Any help appreciated. Thanks in advance.
    Maybe Andy answered your question(s), but this is how I found this particular problem.

    First, here is an article on debugging by Chip Pearson. http://www.cpearson.com/excel/debug.htm

    So I opened the form "frmAttendance"..... and was taken to the debug window. The error dialog box indicates it is something to do with "MeetingID".
    Looking at the highlighted line, I see it is in a function with two arguments: "MeetingID" and "Organization".
    The line that was highlighted has an aggregate function "DCount"; having used aggregate functions before, I know there are 3 things to check: Expr, Domain & Criteria.
    The criteria is from the function arguments, so that seems OK.
    The Domain can be a table or a query. In this case it is a multi-table query. I opened the query in design view to see what fields are available.
    The EXPR is a field in the domain. But in this case, there is no field named "MeetingID" in the query. Looking at the tables in the query, there is also no FIELD named "MeetingID".... but there is a field named "ysnMeetingID". I changed the names and opened the form again.
    Tada! no error.

    So it was obvious that, in two places and several lines, "MeetingID" should be "ysnMeetingID". Don't understand why the prefix "ysn"...... to me, that indicates "YesNo". The PK field is an autonumber type field with a name that indicates it is a Boolean type field is...... confusing.

    I used to use a prefix of "p" for the arguments (parameters) in functions/subs until I created a function that needed the age of an employee. I named the argument "pAge". While I read it as "p Age", Access saw it as "Page" - a reserved word. Now I am trying to use a prefix of "arg"..

  2. #17
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay, that was what I needed. Now, where is the Function meetingAttendance called from? It would help a lot if I knew where it was called from.

    Thanks for your input. Thanks you very much.

    Respectfully,

    Lou Reed

  3. #18
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    It can be called from anywhere because it is a function.
    It can be in a query, in other VBA subroutines or, as in this case, the control source of a text box ("txtAttendancePercent").

    When the form is requeried/recalculated, the function is executed. You have code in the afterupdate event of the combo box ("cboMeetingID") that requeries the form, which recalculated the text box.

    I would have the subform requeried first, THEN the main form, but.... it is your dB....

  4. #19
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Thanks, it was o much help. I appreciate you taking the time to get this answer.

    Respectfully,

    Lou Reed

  5. #20
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Steve I wouldn't consider anything I post an "answer" haha.

  6. #21
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I think that I know what the issue was here - in addition to my unfamiliarity of building combo boxes without using the Wizard. It appears is much more dependent on the frmAttendance
    than I initially believed. The code and the form share variable names, etc. This makes it necessary to match the frmAttenddance variables names and the code variable names. That is where I went wrong. I considered
    it to be like a trig function interior code and name in trig function were not important. In the case or example they are.

    That was my failing and that is why it seem we were taking in different directions. I appreciated the patience of the responders to my dumb questions. All I can say is thank you.


    Respectfully,

    Lou Reed

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 12
    Last Post: 08-23-2016, 09:22 AM
  2. Replies: 20
    Last Post: 10-13-2015, 09:05 AM
  3. Replies: 3
    Last Post: 10-16-2014, 08:49 AM
  4. Replies: 7
    Last Post: 05-28-2013, 09:11 AM
  5. Replies: 1
    Last Post: 05-04-2013, 12:19 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