Originally Posted by
Minty
Having just done some testing on both some subforms, and a straightforward continuous form, I can't replicate this behavior.
That would indicate something else is happening, so what other events are set to trigger in that detail / form?
I think the PROBLEM is in the continous form NOT in the sub forms and here is the ONLY two events I have in the main form where the problem actually is:
Code:
Private Sub Sti_til_fil_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyReturn
If Me.ActiveControl = Me.Sti_til_fil Then
Sti_til_fil_DblClick Cancel
Else
End If
End Select
End Sub
Private Sub Sti_til_fil_DblClick(Cancel As Integer)
If Not ErAngivet(Me.Sti_til_fil) Then
If Not ErAngivet(Me.Benævnelse) Then
FejlMeld ("Der skal angives BÅDE benævnelse OG notat !")
Me.Benævnelse.SetFocus
Cancel = True
Else
Me.Sti_til_fil.Locked = False
Me.Sti_til_fil.Text = "Notat-" & NotatID.Value & ".docx"
Me.Sti_til_fil.Locked = True
Set WRDobj = CreateObject("Word.Application")
' WRDobj.Visible = False
Set doc = WRDobj.Documents.add
doc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text = "NotatID: " & Me.NotatID.Value & "-" & Me.Benævnelse.Value
doc.SaveAs TrimFrom("Right", CurrentDb.Name, "\") & "NOTAT_docs\" & Me.Sti_til_fil.Text, wdFormatDocumentDefault
WRDobj.Quit
Set doc = Nothing
Set WRDobj = Nothing
OpenNativeApp TrimFrom("Right", CurrentDb.Name, "\") & "NOTAT_docs\" & Me.Sti_til_fil
End If
Else
OpenNativeApp TrimFrom("Right", CurrentDb.Name, "\") & "NOTAT_docs\" & Me.Sti_til_fil
End If
End Sub
Notice that a break point at these two subs will NOT stop the execution (ofcause not in the keydown event because I use the mouse !)
In ALL my other continous sub forms the execution STOPS at a break point at the double click event sub ... I think that prooves it has nothing to do with the code in the event sub - right ?
Please DO REMEMBER what the problem is ... double clicking in the textbox at a record WITHOUT focus !
(if I double click in the textbox at the record in focus ALL works nicely !)
The content of the textbox is just plain text ... just happened to be a file name.