Moving form to top

G

Greg

on my main form I have a subform. I am highlighting record from a subform
and on subform's Form DoubleClick event
i have the following code
Parent.Recordset.FindFirst "[CustomerID]=" & Me.[CustomerID]

However every time selected record is loaded into main form, form stops in a
middle of the screen and I have to scroll eveyt ime to get to the top of the
form. Is there is a code that will bring mainf form all wat downt to top?
 
O

Ofer Cohen

To move to the first record in the form you can use

Docmd.GoToRecord , , acFirst

Or, using Requery will refresh the form and move to the first record

Me.Requery
 
G

Greg

I don't want to move to the first record. Everything is working ok, but when
I click on selected record from subform and record in loaded in main form,
this form stops in a middle and I have to use horizontal bars and scroll to
the top of this form. there is no problem with the code I just don't want to
scroll to top of the form every time I a selecting record from subform

Ofer Cohen said:
To move to the first record in the form you can use

Docmd.GoToRecord , , acFirst

Or, using Requery will refresh the form and move to the first record

Me.Requery


--
Good Luck
BS"D


Greg said:
on my main form I have a subform. I am highlighting record from a subform
and on subform's Form DoubleClick event
i have the following code
Parent.Recordset.FindFirst "[CustomerID]=" & Me.[CustomerID]

However every time selected record is loaded into main form, form stops in a
middle of the screen and I have to scroll eveyt ime to get to the top of the
form. Is there is a code that will bring mainf form all wat downt to top?
 
O

Ofer Cohen

To move to the top of the form

1. Set the focus to a text box in the top of the form

Me.[TextBoxName].SetFocus

2. Use sendKeys with PageUp

SendKeys "{PGUP}"

You might need to set the focus first to the mainform
Forms![MainFormName].SetFocus

--
Good Luck
BS"D


Greg said:
I don't want to move to the first record. Everything is working ok, but when
I click on selected record from subform and record in loaded in main form,
this form stops in a middle and I have to use horizontal bars and scroll to
the top of this form. there is no problem with the code I just don't want to
scroll to top of the form every time I a selecting record from subform

Ofer Cohen said:
To move to the first record in the form you can use

Docmd.GoToRecord , , acFirst

Or, using Requery will refresh the form and move to the first record

Me.Requery


--
Good Luck
BS"D


Greg said:
on my main form I have a subform. I am highlighting record from a subform
and on subform's Form DoubleClick event
i have the following code
Parent.Recordset.FindFirst "[CustomerID]=" & Me.[CustomerID]

However every time selected record is loaded into main form, form stops in a
middle of the screen and I have to scroll eveyt ime to get to the top of the
form. Is there is a code that will bring mainf form all wat downt to top?
 

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