Results 1 to 9 of 9
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box Behaviour in Subform (2003)

    The After Update event of the first combo box uses ADO to insert or modify a record in the meteo table. Access sees this as a change by another user (or process).

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

    Re: Combo Box Behaviour in Subform (2003)

    Thank you Hans,
    How do you get rid of that message?
    I've tried to use the SetWarnings method inside the AfterUpdate event(see below) sub for both combo boxes to no avail.
    <pre>Private Sub Testo83_AfterUpdate()
    Set cnn = CurrentProject.Connection
    rst.Open "meteo", cnn, adOpenKeyset, adLockOptimistic
    rst.Filter = "Giorno= " & [Giorno] & " and ora = 8"
    DoCmd.SetWarnings False
    If rst.EOF Then

    Dim cmd1 As ADODB.Command

    Set cmd1 = New ADODB.Command
    With cmd1
    .ActiveConnection = CurrentProject.Connection
    .CommandText = "INSERT INTO meteo(giorno, ora, tempo) VALUES (#" & _
    Format(Me.Giorno, "mm/dd/yyyy") & "#, 8, " & [Testo83] & ")"
    .CommandType = adCmdText
    .Execute
    End With
    Else
    rst.Fields("tempo") = [Testo83]
    rst.Update
    End If
    DoCmd.SetWarnings True
    On Error Resume Next
    rst.Close
    Set rst = Nothing
    Set cnn = Nothing
    End Sub</pre>


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

    Re: Combo Box Behaviour in Subform (2003)

    Try Me.Requery near the end of the code.

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

    Combo Box Behaviour in Subform (2003)

    In the startup form of the attached mdb, if you pick a value from the 8 combo box in the FrmMeteo subform and then proceed to pick a value from the Testo83 combo box below it, you get the message:
    <font color=red>The data has been changed. Another user edited this record and saved the changes before you attempted to save your changes.
    Re-edit the record.</font color=red>

    I've never seen such a message and it doesn't appear if I step through the code. What's causing the message to pop up?

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

    Re: Combo Box Behaviour in Subform (2003)

    Thank you Hans <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

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

    Re: Combo Box Behaviour in Subform (2003)

    Your code has become far too complicated to analyze, with After Update and On Change events for the same control etc. The only advice I can give is to reconsider whether you really need all that code, and to remove as much of it as possible.

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

    Re: Combo Box Behaviour in Subform (2003)

    I get a similar message for the FPersonale subform in the same file.
    If, on the startup form of the attached mdb, you type anything in any of the text boxes of the FPersonale subform(which, in form view, is labeled "Shift schedule") you get a message titled "Write Conflict" saying that during the current session the record had been modified by another user, asking to choose between saving the record, copying the edits to the clipboard or discarding the edits.
    I've tried to get rid of the message using the same tacticts you suggested for the FrmMeteo subform: putting
    Me.Requery near the end of the text boxes' AfterUpdate event code but this time the message still pops up.

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

    Re: Combo Box Behaviour in Subform (2003)

    Giorgo,

    Changing the cursor type in the 4 open statements from adLockOptimistic to adLockBatchOptimistic seems to get rid of the problem.
    Francois

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

    Re: Combo Box Behaviour in Subform (2003)

    That it does!!! <img src=/S/joy.gif border=0 alt=joy width=23 height=23> <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>
    Plus also inserting a Me.Requery
    inside the If...Then...Else loop of the four text boxes' AfterUpdate event for the FPersonale subform.
    Thank you so much Francois

Posting Permissions

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