Move Cell in a Subform

G

Guest

Hi All

I have a subform that is displaying data using a
datasheet and the subform is using the the following code
to reset the cursor focus to the PURCHASE_TYPE cell where
the invalid data was entered:

Dim iLeft As Integer
Dim iTop As Integer

Private Sub PURCHASE_TYPE_GotFocus()

iLeft = Form_subFrmDepartments.Form.SelLeft
iTop = Form_subFrmDepartments.Form.SelTop

End Sub

Private Sub PURCHASE_TYPE_LostFocus()

Form_subFrmDepartments.Form.SelLeft = iLeft
Form_subFrmDepartments.Form.SelTop = iTop

End Sub


However the line of code
Form_subFrmDepartments.Form.SelLeft = iLeft

Produces the following errors:
err.Number = 2101
err.Description = The setting you entered isn't valid
for this property.

But when I modify this line of code to
Form_subFrmDepartments.Form.SelLeft = iLeft + 1 no error
is prodcued and the focus is on the cell to the right of
where the data was entered as expected.

Can any one assist me in being able to set the focus of
the cell from where I orginally came from if a condtion
is not met. Any assisatnce would be apprecitaed.

Thanks in Advance.
 

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