Form clicking requires 2 clicks to go to next record!?!?

DuncanMcCloud

New member
Local time
Today, 16:14
Joined
Feb 20, 2007
Messages
4
Hey Readers,

I'm using MS OFFICE 2003...MS ACCESS

I am having a problem in my one form where I have to click on the "go to next record arrow" twice before it displays the next record. (even on the "create new record" it requires 2 clicks)

All other forms I have display the next record for only a single click on the arrow.

Is there something unique in the properties of the form in question that needs to be changed so that a single click displays the next record?

Any help would be greatly appreciated.

Thanks,
Duncan
 
do you have any code that saves the record or refreshes the recordsource?
 
do you have any code that saves the record or refreshes the recordsource?
There is a text field that gets the firstname, lastname and title appended each time the user completes a new client form.

e.g.
Form_frmClient.companyname.Value = LTrim(IIf([LastName] = "", [firstname] & " " & [Title], [LastName] & " " & [firstname] & " " & [Title]))

This all gets saved on LostFocus and once for GetFocus.

I understand what youre getting at, but i cant see in the form code where i can be refreshing the screen more than once, since when i am clicking next i am just scanning through the records in the form view and not entering new data.

But this 2 click thing happens regardless of entering new data or just scanning though the records.
 
here is the code for the form in question:

Option Compare Database

Private Sub companyname_BeforeUpdate(Cancel As Integer)
Form_frmClient.companyname.Value = LTrim(IIf([LastName] = "", [firstname] & " " & [Title], [LastName] & " " & [firstname] & " " & [Title]))
Form_frmClient.OrderBy = "LastName"
Form_frmClient.OrderByOn = True
End Sub

Private Sub companyname_GotFocus()
Form_frmClient.companyname.Value = LTrim(IIf([LastName] = "", [firstname] & " " & [Title], [LastName] & " " & [firstname] & " " & [Title]))
End Sub

Private Sub companyname_LostFocus()
Form_frmClient.companyname.Value = LTrim(IIf([LastName] = "", [firstname] & " " & [Title], [LastName] & " " & [firstname] & " " & [Title]))
End Sub

Private Sub FirstName_LostFocus()
Form_frmClient.companyname.Value = LTrim(IIf([LastName] = "", [firstname] & " " & [Title], [LastName] & " " & [firstname] & " " & [Title]))
End Sub

Private Sub Form_AfterInsert()
Form_frmCorrespondance.setStatus
Form_frmContact.setStatus
End Sub

Private Sub cmdMedicalNotes_Click()
On Error GoTo Err_cmdMedicalNotes_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmMedicalNotes"

stLinkCriteria = "[clientid]=" & Me![ClientID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdMedicalNotes_Click:
Exit Sub

Err_cmdMedicalNotes_Click:
MsgBox Err.description
Resume Exit_cmdMedicalNotes_Click

End Sub

Private Sub LastName_LostFocus()
Form_frmClient.companyname.Value = LTrim(IIf([LastName] = "", [firstname] & " " & [Title], [LastName] & " " & [firstname] & " " & [Title]))
End Sub

Private Sub Title_LostFocus()
Form_frmClient.companyname.Value = LTrim(IIf([LastName] = "", [firstname] & " " & [Title], [LastName] & " " & [firstname] & " " & [Title]))

End Sub
 
I figured it out.

If the field is one that is updated with the code as per the single line of code (see above) for each form field, then the active field (the box where the keyboard cursor is active) cannot be one of these fields that are updated.

So what i did was i changed it so that the data is updated once the user has entered the lastname; since the active block of the form is always the first field i made it such that the lastname (4th field) wont be active when browsing through the records.

However this does not solve it entirely. If the user placed his mouse cursor over the lastname field and made it the active block, then when the user browses through the records it will require 2 clicks as before.

I still want to try get rid of that entirely though.

Cheers.
 
change the LastName_LostFocus() to an AfterUpdate() event
 

Users who are viewing this thread

Back
Top Bottom