Results 1 to 14 of 14
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Text box Control Source Problem (2000)

    If you select Dec 31, 2003 on the calendar in the attached mdb, the txtQt text box on the startup form displays the value 600. And that's the correct behavior because the underlying field(fldQT) has that value for Dec 31, 2003 but why, if I select Jan 1, 2004, the value stays the same while it should be 500?
    Attached Files Attached Files

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Text box Control Source Problem (2000)

    The textbox txtQt displays 600 no matter what you select from the calendar, even if you select nothing.

    The forms is bound to table PortDez23, and opens to the first record of that table. txtQT is bound to the field fldQT so it displays the value of that field for the first record.

    If you choose a value from the calendar, you change the value in the unbound textbox txtCdata.

    For txtQt to change , the form would then have to move to a different record. There is nothing there to make it do that.

    You could apply a filter , such as:
    <pre> Dim strfilter As String
    strfilter = "[Giorno]=#" & Me!CGior & "#"
    Me.Filter = strfilter
    Me.FilterOn = True
    </pre>


    in the after-update event of the calendar.
    Regards
    John



  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Text box Control Source Problem (2000)

    When the database is opened, there are two error messages: :Runtime error 13 ; type mismatch"

    If you click debug, you get taken to

    If port = 0 Or IsNull(port) Then

    which is a line in the function
    Function CEner(ener, port, ren, sal)

    I can't find the event that calls this function, so i have no idea what is going on.

    The error message means that you are performing an operation that is not approrpiate foir the type of data in a variable.
    Regards
    John



  4. #4
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Text box Control Source Problem (2000)

    Hi John, I have carried out your advice pertaining applying a filter in the After Update event of the calendar(please see attachment).
    There's no event calling this function, the function(similarly to all the other functions in Module1) is called in the Control Source for the Coeff text box. Can you figure out what the problem is giving the Run-time error '13' ; Type mismatch ?
    Attached Files Attached Files

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Text box Control Source Problem (2000)

    I haven't got time to follow this right through at the moment, but I can tell you that the problem with the function call in the control source with Coeff is that it uses the Port1
    text box (which is itself calculated using a different function) as one of its parameters, and Port1 is showing the value #error.

    So Coeff can't work out its value unless its inputs are working! Port1 uses other calculated values as its input parameters.

    So you need to clearly identify the chain of calculations. Start at the first one and see if it is correct, then follow the chain through checking each step.
    Regards
    John



  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Text box Control Source Problem (2000)

    Building in error checking in the functions gets rid of the Error 13. (Thanks to John Hutchison for making me think of this.)
    Attached Files Attached Files

  7. #7
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Text box Control Source Problem (2000)

    Thank you Hans, problem is now, irrespective of whichever date you choose in the calendar, all the text boxes remain blank or frozen and I still can't figure out how to solve the error that causes them to do so.

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Text box Control Source Problem (2000)

    For dates in 2004, nothing happens since there are no data for 2004. For dates in 2003, the text boxes are populated - in the attached screenshot, the date is 31 December 2003.
    Attached Images Attached Images
    • File Type: png x.png (5.4 KB, 0 views)

  9. #9
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Text box Control Source Problem (2000)

    That's odd, I've just downloaded the file you attached to your 375765 post and opened it and selected Dec 31, 2003(see picture below) and I get either frozen or blank text boxes.
    Attached Images Attached Images

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Text box Control Source Problem (2000)

    It's unlikely that regional settings play a role here, I switched to Italian settings to test, and I still got the same results. The only other difference I can think of is that I am using Access 2002 instead of 2000. So maybe someone with Access 2000 can take a look.

  11. #11
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Text box Control Source Problem (2000)

    I have opened Han's version in 2000, and I get inconsistent results. I can't work out why.

    Cdata does not always get updated when you click the calendar. I notice that the code for this has been moved to the Click event, while previously it was in the afterupdate event. In my limited testing it works more reliably in the afterupdate, but I don't know it works sometimes and not other.

    There is another run time error in yet another function, when you select Jan 1 2004 as the date.

    This one is in function Qx,at the line por = p * Qut/(p +1p)

    in the Load event of the form, you set the value of the Calendar to date, but this does not carry through to CData, so it would ge a good idea to set that value in the Load event as well.
    Regards
    John



  12. #12
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Text box Control Source Problem (2000)

    Ok, thank you so much John, you're great! <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>
    Now everything works(see attachment) except for the fact that, as you mentioned in your last post, in the Load event of the form, the value of the Calendar is set to Date, but this does not carry through to CData so you said it would be a good idea to set that value in the Load event as well. But...uh...the Load event of what?
    Attached Files Attached Files

  13. #13
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Text box Control Source Problem (2000)

    In the onload event of the form Dezzo you currently have.
    <pre>Private Sub Form_Load()
    Me.CGior.Value = Date
    End Sub
    </pre>


    Change it to
    <pre>Private Sub Form_Load()
    Me.CGior.Value = Date
    Me!Cdata = Date
    End Sub
    </pre>

    Have you tracked down the other problem with mismatch?
    Regards
    John



  14. #14
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Text box Control Source Problem (2000)

    Thank you my friend,
    Yes, I've tracked it down, you can see the function Qx in the Module1 module has been modified. It was all due to the fact when it was called as control source of the Port1 text box, its p argument could assume non-numeric values.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •