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

Changing check box status based on info inserted in table

Status
Not open for further replies.

avaffa

Programmer
Jun 22, 2001
86
0
0
US
I have created a form that contains check boxes, which inserts text values into a field. For example, If the check box called "Aging" is checked, then the text "Aging" will be placed in the "TEMP_Aging" field. I have several of these check boxes on the form and when multiple boxes are checked, values of all boxes checked are placed in a field called "Headers." The values are separated by semicolons (e.g. Aging; Business; Technology;). I have also created a web site which allows the user to update this info using check boxes on a web page, which changes the value of the "Headers" field b/c the changes are being dumped directly into an Access database. How can I get the appropriate check boxes to be displayed as "checked" on the form based on the info inserted directly in the "Headers" field within the table? The values in the "Headers" field are separated by semicolons and entered directly into the table. Below is the code used for each check box. Thanks!

Private Sub Aging_Click()
If Aging = True Then
TEMP_Aging.Value = "Aging; "
Else
TEMP_Aging.Value = Null
End If
TEMP_Headers.Value = TEMP_Aging.Value & TEMP_The_Arts.Value & TEMP_Business.Value & TEMP_Career_Development.Value & TEMP_Child_Dev.Value & TEMP_Communication.Value & TEMP_Computers_and_Computing.Value & TEMP_Conflict_Resolution.Value & TEMP_Crime_Violence & TEMP_Cultural_Issues.Value & TEMP_Econ_Dev.Value & TEMP_Driving & TEMP_Education_and_Teaching.Value & TEMP_Engineering.Value & TEMP_Environment.Value & TEMP_Estate_Planning.Value & TEMP_Ethics & TEMP_Exercise_and_Sports.Value & TEMP_GMU.Value & TEMP_Government.Value & TEMP_Health.Value & TEMP_History.Value & TEMP_HR.Value
Headers.Value = TEMP_Headers.Value & TEMP_International_Business.Value & TEMP_Internet.Value & TEMP_Language.Value & TEMP_Law_Enforcement & TEMP_Literature.Value & TEMP_Math_and_Statistics.Value & TEMP_Media & TEMP_Nonprofit_Orgs.Value & TEMP_Philosophy.Value & TEMP_Politics.Value & TEMP_Psychology.Value & TEMP_Public_Policy_and_the_Law.Value & TEMP_Public_Speaking.Value & TEMP_Real_Estate.Value & TEMP_Regional_Issues.Value & TEMP_Religion.Value & TEMP_Research.Value & TEMP_Science_and_Technology.Value & TEMP_Social_Issues.Value & TEMP_Stock_Market.Value & TEMP_Terrorism & TEMP_Transpo & TEMP_Women.Value & TEMP_World_Issues.Value & TEMP_Writing.Value & TEMP_Taxes.Value & TEMP_Security.Value & TEMP_Parenting.Value & TEMP_Bankruptcy & TEMP_Creditors_Rights & TEMP_Management

End Sub

The following code works only if info is entered using the form. I need to insert data directly into a table and have the appropriate check boxes be selected on the form.

Aging.Value = (InStr(Headers.Value, "Aging;") > 0)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top