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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grouping text boxes within one control

Status
Not open for further replies.

DanielleH

Programmer
Jun 5, 2001
9
US
I was wondering how I can group a number of text boxes and call them one name - e.g. have two text boxes named "txtName" and "txtAccountNum" and be able to have those text boxes under some sort of control named, let's say "AcctDetails". I could then have code to the effect of "AcctDetails.Left = 1.3" and both the "Left" properties of "txtName" and "txtAcctNum" would be set to 1.3.
I believe it can be done in Visual Basic but am not sure how it can be done in an Access Report. Any help would be much appreciated.
 
You can't name things the same in access or visual basic, it's not allowed. What you can do is utilize the tag property of the controls which allows you to put a string value that you could use to identify your Name and AcctNbr fields. So let's put Name in the two txtName's tag property and we'll use some code to search for that tag and change your left property accordingly.

Here's what the code looks like:

[tt]
Dim ctl As Control
Dim rpt As Report

Set rpt = Me

For Each ctl In rpt
If ctl.Tag = "Name" Then
ctl.Left = 1.3
End If
Next
[/tt]

HTH Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top