Results 1 to 15 of 15
  1. #1
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    Error in creating subform control source

    I believe that I have found another error in the Ceil Inn tutorial.



    In the area where they are creating a subform (RoomOccupancySummary) the control source for Room Use
    is stated:

    =[sbfOccupancies]*[Form]*[txtRateTotal]

    I believe it should be:

    =[sbfOccupancies]*[Form]*[txtRoomUse]


    in other words replace [txtRateTotal] with [txtRoomUse] and it should work.


    I am not sure what the formula is doing (I know it is calculating Room Use, but I am not clear how it is doing that), but on examining the other two formulas it appears that this correction is required.

    Is this accurate?

    Thanks in advance.

    Respectfully,


    Lou_Reed
    Last edited by Lou_Reed; 05-21-2015 at 10:56 AM. Reason: error

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    The * characters do not make sense in that context and the expression will error. Consider:

    =[sbfOccupancies].[Form].[txtRoomUse]
    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.

  3. #3
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I did.

    It just seems odd to use in that formula txtRateTotal instead txtRoomUse. As you can see in the third formula they
    use is

    =Nz([txtRoomUse])+Nz([txtPhoneUse])

    this is clearly the sum of the first two calculated values. RoomUse and PhoneUse. So it would make sense to change
    the first formula from

    =[sbfOccupancies].[Form]![txtRateTotal]

    to

    =[sbfOccupancies].[Form]![txtRoomUse]

    Again I am not sure what these terms are I am only analyzing them in context.

    I need to know more about Nz I am guessing.

    ley me check Nz and see what it means.

    Respectfully,


    Lou_Reed

    Thanks in advance.


    Respectfully,


    Lou_Reed

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    What is RoomUse data? Why would it be added to phone charges?
    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.

  5. #5
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I see your point. I guess then based on that fact, that the third and final formula on that page is incorrect. Since it also uses RoomUse data.

    The final value is the sum of the first two calculations so it also cannot use RoomUse data.

    This is another error in the Ceil Inn tutorial?

    Thanks for your response. it is much appreciated.

    Respectfully,


    Lou_Reed

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Possibly error. Already confirmed other errors.
    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.

  7. #7
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Yes, but don't you think it easier if there were a way for it to show all undefined variables in the program or system. I assume
    this is interpreted code.

    Maybe we are spoiled, but when it points out undefined variables it make life a little easier.

    Respectfully,


    Lou_Reed

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Not sure what you mean. Use of Option Explicit in module headers will force all VBA variables to be declared. If controls are improperly referenced in VBA, the debug compiler will error. If controls are improperly referenced in Access forms and reports expressions or in queries, an error will be indicated or trigger input prompt.
    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.

  9. #9
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I guess that I have been bitten by this error before. In programming the error jumps out at you
    usually during compile time, but certainly during run time.

    By the way, what does txtRateTotal mean. In other words what does putting the txt in front of a variables name
    do?

    Respectfully,


    Lou_Reed

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Prefixing variable or object names with an indication of the type is a common (and optional) naming convention. In this case txt probably means a textbox (I use tbx). cbx could be for combobox, lbx for listbox, lbl for label, etc.

    VBA variables could be like dblAmt, intQty, txtName, dteStart, etc.

    Whatever convention you adopt, be consistent.
    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.

  11. #11
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay, but I think it is the only place the txt is used on the variables in question.

    Also, should not the NewOccupancy Form have navigation buttons? We putting more that than one date for
    Customer Accnt. 100752 by Employee 24095.

    It seems another Ceil Inn tutorial error?


    Respectfully,


    Lou_Reed

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Do you mean the intrinsic navigation bar at bottom of form? Activate if you want to.
    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.

  13. #13
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Yes that is what I meant. I will activate to see if it helps in inputting data.

    Respectfully,

    Lou_Reed

  14. #14
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I will activate the navigation button on the NewOccupancy form. It seems the only way to input multiple pages of data
    on the NewOccupancy form.

    However, just to be sure. Am I missing something here? Is there a way to input multiple pages of data on this
    NewOccupancy form and not need to use navigation buttons?

    Any help appreciated. Thanks in advance.

    Respectfully,


    Lou_Reed

  15. #15
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Unless the form is opened by another form and only to a new record row then closed after entering single record, there must be a method for navigating. If not the intrinsic bar then custom command buttons.
    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.

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

Similar Threads

  1. Replies: 1
    Last Post: 03-30-2013, 12:41 PM
  2. Control Source Error ?
    By bellevue in forum Forms
    Replies: 8
    Last Post: 06-02-2012, 12:47 PM
  3. Replies: 5
    Last Post: 11-16-2011, 07:30 PM
  4. Replies: 5
    Last Post: 10-13-2011, 03:36 PM
  5. Charts within subform in a control source
    By GraemeG in forum Forms
    Replies: 0
    Last Post: 06-03-2011, 04:38 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