Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / March 2007

Tip: Looking for answers? Try searching our database.

Linking Check Boxes To A Text Box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pedders - 24 Mar 2007 11:12 GMT
I have a text box (tapes) running from a query showing the values of
0,1,2,3,4 on a form, I have 4 check boxes, tape 1, tape 2, tape 3, tape 4.

I want the number in the text box to determine how many check boxes appear
on my form.
Daniel - 24 Mar 2007 17:30 GMT
Create a looping function that enables or disables the checkboxes accordingly.

intNumChks = Me.Tapes
for i = 1 to intNumChks
  Me("chkbox" & i).enabled = True
Next i
for j = intNumChks+1 to 4
  Me("chkbox" & i).enabled = False
Next j

This is air code but should illustrates the principle.

Hope this helps,

Daniel P

> I have a text box (tapes) running from a query showing the values of
> 0,1,2,3,4 on a form, I have 4 check boxes, tape 1, tape 2, tape 3, tape 4.
>
> I want the number in the text box to determine how many check boxes appear
> on my form.
John W. Vinson - 24 Mar 2007 18:15 GMT
>I have a text box (tapes) running from a query showing the values of
>0,1,2,3,4 on a form, I have 4 check boxes, tape 1, tape 2, tape 3, tape 4.
>
>I want the number in the text box to determine how many check boxes appear
>on my form.

ummmm....

Sounds like a pretty serious table design flaw, if these four textboxes are
bound to four non-normalized table fields! Someday you will need a FIFTH tape,
I'm guessing.

That said - you can use the Form's Current event to toggle the visibility of
the checkboxes. Assuming they are named chk1, chk2, chk3 and chk4, use code
like

Private Sub Form_Current()
Dim iChk As Integer
For iChk = 1 to 4
  If NZ(Me.Tapes) < iChk Then
     Me.Controls("chk" & iChk).Visible = (iChk <= NZ(Me.Tapes))
  End If
Next iChk
End Sub

            John W. Vinson [MVP]
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.