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!

Field values and check boxes

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 table. How can I get the appropriate check boxes to be displayed as "checked" on the form based on the new values in the "Headers" field? Remember the values in the "Headers" field are separated by semicolons. 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
 
You could try something like the following:

Aging = (Instr(TEMP_Headers.Value, "Aging;") > 0)

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
At the place where you are assigning values to the checkboxes based on the new values of the Header field.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
The database is set up so that I'm assigning values to the "Headers" field based on the values of the check boxes, not the other way around. I want to be sure that I can still select check boxes manually on the form to assign values to the "Headers" field. I need to update the database by inserting the records from the dummy table used with the web site and AND manually selecting check boxes on the form. Is this possible?
 
Sorry, I misunderstood your question, " How can I get the appropriate check boxes to be displayed as "checked" on the form based on the new values in the "Headers" field?"

I'm obviously not fully understanding your situation, so perhaps if you more fully explain what forms are in play from the Access side, and what binding is in force, and what is in play from the Web site and how it's all interacting, may be able to come up with a better alternative.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
On the form, the values in the "Headers" field are based on the values of the check boxes on the form. If the "Aging", "Business", and "Technology" check boxes are selected, then the value of the "Headers" field will be "Aging; Business; Technology;"

On the web site, the values in the "Headers" field are also based on the values of the check boxes on the web page. (The values are separated by semicolons.) The data submitted by users is being dumped into a dummy table.

I need to update the table attached to the form with the info contained in the dummy table. My problem is that I cannot get the check boxes to be displayed as being selected for the values contained in the "Headers" field.
This is because the values in the "Headers" field are based on the values of the check boxes on the form. I need to reverse this while still being able to manually assign values to the "Headers" field using the check boxes on the form.
 
Can you read the value of Headers from the dummy table?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Yes, it's displayed in the following format:

"Aging; Business; Technology
 
At the point where you've read that line, then run the code that I previously suggested to set the check boxes accordingly. The suggested code should work for the Aging checkbox, and the rest of the checkboxes will be in the same format.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
The Instr function returns a number. I need to insert a text value into the field linked to each check box and show the check box as being selected.
 
If you look at the code I suggested, the expression will return True/False which is the value used to set the Checkbox. That should in turn trigger to click event which will update the text and update the Headers value in the local form.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
It works if the values are entered through the form, but it doesn't work if they are entered through the table which is how I will update the table.
 
I'm sorry, but given the information at hand, I don't know what else to suggest.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
OK, thanks! I really appreciate your help. If anyone else has any suggestions, please post them. Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top