Using a quick key to navigate wont work

S

Sue Compelling

Hi

I have the following code in my form, which works perfectly for another DB
but in my new DB, rather than going to the "txtNewText" field - using F5
causes me to jump to the 1st record in my DB and the set.focus to the
"cboSearch" field


Private Sub form_keydown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyF5
txtNewText.SetFocus
End Select
End Sub



I have the following code on my cboSearch field (though cannot determine
whether anything is looping):

Private Sub cboSearch_AfterUpdate()
With Me.RecordsetClone
.FindFirst "ContactID = " & cboSearch
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
Me.txtNewText.SetFocus

End Sub



And finally, the following code on my txtNewText field: (you'll see I've had
help from this forum in writing these)

Private Sub txtNewText_AfterUpdate()

If Nz(Me.Notes, "") = "" Then
Me.Notes = Now() & " - " & Me.txtNewText
Else
Me.Notes = Me.Notes & vbCrLf & Now() & " - " & Me.txtNewText
End If

'Further examination of your code suggested following lines should be
'outside the Id/Else/End If but I'll leave that to you to decide.

Me.NewNotesDate = Date
Me.txtNewText = "<F5 to enter new notes info here>"
Me.StudentStatus.SetFocus

End Sub

TIA ....
 
G

Graham Mandeno

Hi Sue

(Most likely) Do you have the KeyPreview property for the form set to "Yes"?

(Less likely) Do you have an AutoKeys macro that defines a global behaviour
for the F5 key?

Nice to "see" you again :)
 
S

Sue Compelling

Hey Graham

How very wise - and on the money as always. I went through both my forms to
try and match them but of course the KeyPreview Property is right down the
bottom and hid from me. Hey - I di my first union query yesterday - what a
brilliant function!!!

Nice to see you again too -

ps - your books have said they miss you and want to come home - so you're on
my list
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top