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

    Using events to assign field values (2000)

    If, in the startup form of the attached mdb, you select January 1, 1997 on the calendar and edit the value in the LETTUR text box in the GRUPPO 1 section of the tab control, everything works smoothly. If you try and do the same for the LETTUR text box on the GRUPPO 2 section, you get the message, "Run-time error '-214735267 (80020009)': It's impossible to assign a value to the object" and the code stops at the line
    <font color=red>Energia = EnerOm2("g2dez", "dezg2k", [Giorno], [ORE_MARC], Me!LETTUR, Me!LETTUR1)</font color=red>
    I don't see any difference in how the two subforms are laid out. What could be the problem?

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using events to assign field values (2000)

    In both Before update event of the forms, you have :
    If Me.ORE_FERM > 0 And IsNull(Me.CODF) Then
    MsgBox "Attenzione. Selezionare un valore dalla lista dei fermi.", vbExclamation
    Me.CODF.SetFocus
    Cancel = True
    End If
    In the form MG2dez, the textbox ORE_FERM did not exist. The textbox with the same place as ORE_FERM in MG1dez has the name OREF
    Francois

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

    Re: Using events to assign field values (2000)

    In MG1Dez, the text box named Energia is bound to the field named ENERGIA. You can modify the value in the text box, and thereby the value of the bound field, in code.

    In MG2Dez, the text box named Energia is not bound to a field, it is a calculated control instead, with control source

    =enerom("g2dez","dezg2k",[giorno],[ore_marc])

    The value of a calculated control cannot be modified, whether it be manually or in code.

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

    Re: Using events to assign field values (2000)

    Thank you guys <img src=/S/hugs.gif border=0 alt=hugs width=41 height=25>

Posting Permissions

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