Prevent Cursor From Moving On Image / Form Change

mjseim

Registered User.
Local time
Today, 08:54
Joined
Sep 21, 2005
Messages
62
I've created a form. Within that form I have an image control. I am using this code to pull the corresponding plant image from a folder filled with JPGs.

It works just fine except one thing. When I change from record to record my cursor jumps to the center of the pulled JPG. I don't want my cursor to move at all when loading these images. Is this possible? Thanks.

Code:
Private Sub Form_Current()

Dim FileExistsbol As Boolean
Dim stFileName As String
 
stFileName = CurrentProject.Path & "\- Landscaping Material Images\" & _
    [LandscapeCommonName] & ".jpg"
stFileName = Trim(stFileName)
FileExistsbol = Dir(stFileName) <> vbNullString

If FileExistsbol Then
        [LandscapeMaterialImage].Visible = True
        Me![LandscapeMaterialImage].Picture = stFileName
        [LabelNoPictureAvailable].Visible = False
    Else
        [LandscapeMaterialImage].Visible = False
        [LabelNoPictureAvailable].Visible = True
End If

End Sub
 
Just add this in your code:
Code:
End If
    [B]Me.YourControlNameToSetFocusTo.SetFocus[/B]
End Sub
 
Ok, I think I see what you're trying to do... your code will force my cursor onto a specific control when a new image is loaded.

Preferably, I would like my cursor to simply not move at all when a new image is loaded.

Otherwise, I'd like it to snap to the "Next Record" button in the navigation toolbar. What is the code for snapping to this button? All I could find was Me.NavigationButtons and that didn't work.
 

Users who are viewing this thread

Back
Top Bottom