Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select all field on form in code

Status
Not open for further replies.

tziviak2

MIS
Jul 20, 2004
53
US
how do I select all the fields on the form in code-because I want to move the top value of the fields?
 
Something like this:

Code:
Dim ctl As Control

For Each ctl In Me.Controls
   'Do stuff to controls
Next ctl

-Gary
 
I would write code to loop through the controls and set the top property.
Dim ctl as Control
For Each ctl in Me.Controls
ctl.Top = ctl.Top -360
Next

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
thank u--it seems to be the right thing to do=but I don't see it working-I put the code-in the on-open of the detail section
is this correct (all the fields are there)
 
here is the code:
Select Case Me!MONTH
Case 9
For Each ctl In Me.Controls

ctl.Top = 1

Next

Case 10
For Each ctl In Me.Controls
ctl.Top = 2
Next
End Select

maybe because it's looking for the info-in one of the fields in the form???-so it's too late?
 
There is no "On Open" of the detail section. I expect your Top values are set in TWIPS where one twip is 1/1440".

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
I meant the on format-what where can I put my code-so that it works?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top