Placing the cursor in a cell in a datasheet form

G

Guest

Hi,

Does anyone know how I can set the cursor to a particular cell in a
datasheet subform that I have created - I would like to generate some VBA
coding to place the cursor in the 3rd column of the last used row in my
datasheet subform.
 
G

Guest

Dim frm As Form
Dim ctl As Control

Set frm = Me!SubFormControl.Form
Set ctl = frm.txtControl3

frm.Recordset.MoveLast
ctl.SetFocus

Set frm = Nothing
Set ctl = Nothing
 
G

Guest

Almost there. Have tried the code - it selects the last row of my datasheet
subform - rather, doesn't actually select the row, but places the little
black triangle in the record selector on the left hand side of the datasheet
form.

But I reckon we are close here. Any other tips/ideas??
--
 
G

Guest

It worked for me. If the triangle is pointed at the last record then it did
select the last record. If it did not put the cursor in the correct control
you may need to be sure the name of the control is correct and that it can be
selected.
 

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