Can Checkboxes Be Used to Input Text into a Field?

D

DoveArrow

I have created an Access database that is designed to send an E-Mail
out to a new student's advisor. As part of this database, I have
created three tables. The first table assigns an ID number each
student advisor based on campus. The second table is designed to
assign an ID number to each active degree program in the system. The
third table takes the ID numbers from these first two tables and
creates a list of the programs each advisor is assigned to. Example:
Let's say that Joe Schmoe is the advisor for all Computer Science and
Psychology students attending the Freedonia Campus. Joe's ID number is
1, and the ID numbers for the Computer Science and Psychology programs
are 10 and 15, respectively. That means, the third table looks
something like this:

ID Contact E-Mail ID Academic Program ID
1 1 10
2 1 15

Well, my program works beautifully. The problem is, I want to make it
easy for someone else to update this one table without needing a
couple of cheat sheets. Now I'm just learning about how to use forms,
but I think it would be really slick if you could have a form with the
advisor's E-Mail address listed and a bunch of little checkboxes that
you could check off for every degree program that the advisor advises
for.

Now I've figured out that if I create a fourth table that looks like
this:

ID Contact E-Mail BS.CS BS.PSY
1 (e-mail address removed) BS.CS BS.PSY

I can use a series of queries to update the third table. I've even
figured out some ways to make buttons and macros that will pull all of
the advisors into this fourth table from the first one and so on. The
only thing I need to know now is if it's possible to make a specific
piece of text appear in a field whenever I put a check mark in a
particular box. Example: If put a check mark in a checkbox that says
'brown' next to it, can I get the word 'brown' to show up in a
corresponding field?

Now, I know I can make the word 'brown' appear in a field by changing
the data type in the table to Yes/No and typing the
expression ;"brown" in the format box. However, I'm trying to run
queries, and I've found that since the data types from my different
tables don't match, it won't accept this. If I have made any sense,
can someone please help me with this? Thanks.
 
C

Carl Rapson

You could make your checkboxes unbound and in the Click event add the
appropriate text into a hidden bound textbox for that field. You could even
pull the text from the label checkbox if you want.

Carl Rapson
 
D

DoveArrow

You could make your checkboxes unbound and in the Click event add the
appropriate text into a hidden bound textbox for that field. You could even
pull the text from the label checkbox if you want.

Carl Rapson












- Show quoted text -

Okay, I sort've understand what you're saying. You're saying that if I
leave the checkbox unbound, I can go into Properties and in the On
Click box, I can put in an expression that will update the text box I
want. Unfortunately, I don't know much about writing expressions, so I
don't know what to put in. Any suggestions?
 
D

DoveArrow

Okay, I sort've understand what you're saying. You're saying that if I
leave the checkbox unbound, I can go into Properties and in the On
Click box, I can put in an expression that will update the text box I
want. Unfortunately, I don't know much about writing expressions, so I
don't know what to put in. Any suggestions?- Hide quoted text -

- Show quoted text -

Nevermind. I got it figured out.
 
D

DoveArrow

Nevermind. I got it figured out.- Hide quoted text -

- Show quoted text -

Nevermind. I lied. I figured out how to update the form by changing
the control source to an IIf statement. I tried cross applying the
idea, but I can't make the OnClick event do anything other than give
me error messages.
 
C

Carl Rapson

Nevermind. I lied. I figured out how to update the form by changing
the control source to an IIf statement. I tried cross applying the
idea, but I can't make the OnClick event do anything other than give
me error messages.

You need to post the code in your Control Source and error message you're
getting. From your description, you want the IIf statement to be in the
Control Source of the text box you're updating, not the checkbox. Something
like:

=IIf(chkCheckBox = True, "Brown", "")

Each time the checkbox is clicked (on or off), the text box contents will be
updated. The other way to do it is to create an Event Procedure for each
checkbox and use VBA code something like:

Private Sub chkCheckbox_Click()
If chkCheckbox = True Then
txtTextBox = "Brown"
Else
txtTextBox = ""
End If
End Sub

Of course, you need to use your own control names; I just made these up.

Carl Rapson
 
D

DoveArrow

You need to post the code in your Control Source and error message you're
getting. From your description, you want the IIf statement to be in the
Control Source of the text box you're updating, not the checkbox. Something
like:

=IIf(chkCheckBox = True, "Brown", "")

Each time the checkbox is clicked (on or off), the text box contents will be
updated. The other way to do it is to create an Event Procedure for each
checkbox and use VBA code something like:
Yeah, I tried that, but it doesn't update my table. It just updates my
form.
 
D

DoveArrow

Yeah, I tried that, but it doesn't update my table. It just updates my
form.







- Show quoted text -- Hide quoted text -

- Show quoted text -

I figured out how to get my table to do what I wanted it to do.
Basically, what I did was I created a new column in my fourth table
that would automatically default to the text I wanted. I then ran a
query that only pulled advisors who had the box checked and then ran
my append queries. Now it works like a charm.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top