how to enable/disable textbox based on checkbox value

I have 44 checkboxes, each has a textbox next to it. What I want is when the user selects a checkbox, the textbox next to it will be enabled. Also, when the user unselect a checkbox, the textbox next to it will be disabled and any value entered is cleared.

Another way is whenever the user enters a value in a textbox, the checkbox associate with it is selected and vice versa.

I don't know which way is easier. Any help would be greatly appreciated.


Post your answer or comment

comments powered by Disqus
Dear Friends,

I have searched for this but I couldn't find , I'm sorry this was already discussed.

I Have created form , in which I want to update a textbox, based on the value of list box.

I have YES,NO as the rowsource for the list, and 3 textboxes, name totalloan,totalo_s,totalp_o
Now ,if user selects YES in the list box, totalp_o should be (totalloan-(totalo_s+1000))
if user selects NO in the list box totalp_o should be totalloan-totalo_s

Please help me out...
I tried this
'Private Sub fa_afterupdate()
'If fa = YES Then
'Me.totalp_o = me.totalloan - (me.totalo_s + 1000)
' ElseIf fa = NO Then
' Me.totalp_o = me.totalloan - me.totalo_s
' End If
'End Sub

Hi,

Trying to remember how to hide/disable buttons on a form based on the users security levl they have.

I am trying to figure out how to enable or disable a button based on a selection from an option group. I have an option group with "Yes" and "No".
If the radial button is selected to "Yes" I would like the button enabled to open a form. If the radial button is selected to "No" I would like the button to be disabled. Would anyone know how to fix this and I am trying to also learn VBA, Thanks in advance.

Hello,

I was wondering if there is a way to have a certain field (or control?) become enabled based on what was selected from a list box.
So what I have is a list box with:

- Issued 1
- Issued 2
- Issued 3
- Issued 4

and if the "Issued 1" was selected I would like some controls to become enabled. The controls are:

- Date
- Issued To
- Completed (this is also a list box with yes/no)

Is there a way to do this? I'm still very new to access and especially to VBA coding, so any help would be appreciated

Thanks!
~FOX~

Hello everyone,, I am facing a problem in my database, I searched this forum and googling but couldnt solve my problem. I have a form name purchase order, there in payment information tab, i have a bound combo box, which has 3 values (different countries currancey) and have 3 bound text boxes which are disabled by default.
by selecting anyone value from the combo box, one of the text box should be enabled with value =0 and rest of them should be disabled by value=0.

e.g. I will select Dollar from combo box, the text box which is named txtDollar should be enabled and rest of the two textboxes should be disabled their values should be = 0.
But when I select a value from combobox it shows following error:
"the data has been changed

another user edited this record and saved the changes before you attempted to save your changes.
re-edit the record."

I wrote my code in combobox after update event. Your help will be highly appreciated. thanks

Hi, I'm trying to put a value from subform's textbox B to form's textbox A when form is about to close.

The main form is based on Order table, subform is based on Order_Detail, Order_Detail has a textbox Subtotal in its footer =Sum(EachPrice)

Order table has a field sum, which is a textbox in main form. I would like to do something like this:

When main form is about to close (OnClose event)
For each Order
Order.sum = Order_Detail.Subtotal
Next Order

Pls don't ask me why I would do this, why not make it for a afterupdate event on Subtotal etc. I have been asked to do something like this, not others.

Thanks every much for any help and idea.

Hello,
I've been reading up on selecting records in a list box using VBA but so far I can only find details of selecting a record based on counting how many there are.
Can anyone tell me how to select a record based on its value.
Eg I have txtbox1 which contains ‘=Format(Now(),”WW”) to give me the week number.
I want to look that week number up in LstBox1 and select it using VBA.
Thanks for any help.

Hello!

I have a table, with quantities in a field that I need to split in batches of 25, to build a new table. Example:

object price qty
blah1 1.00 144
blah2 2.00 76

My results need to look like this:

object price qty
blah1 25.00 25
blah1 25.00 25
blah1 25.00 25
blah1 25.00 25
blah1 25.00 25
blah1 19.00 19 (5x25+19=144)
blah2 50.00 25
blah2 50.00 25
blah2 50.00 25
blah2 2.00 1 (3x25+1=76)

I've been able to build a new table based on these values of 25 etc using MOD, but it's making columns. How can I build a new table and make new RECORDS using MODULUS (or another?) technique instead?? I hope this makes sense, and I hope someone can help.
Cheers

Hello,

I need help with something (i attached a database).
I need to run a report based on user's options so i created a form. There are two comboboxes and 2 checkboxes on the form. If the checkbox is checked i want to consider the choice of the user on the particular combobox. If no, to ignore that column.
The second problem is when the user choose "no choice" i want the query to run for all choices without filtering the combobox.

Any suggestions?

Thank you in advance.

I have a Access form with over 100K items numbers and information. I have a button that opens a subform. In the subform I have multiple checkboxes (i.e. 228, 505, 506, etc.) I want to be able to select one or more boxes then apply a filter to the main form based on those selections. i.e. Select 228 and 505 then the form filters based on the field [Sub-Section] = 228 or 505. Any Help or Suggestions?

Hi Folks

Im trying to create a report based on the current form and the subform contained within the main form.

Currently I have a print report button on my main form.The report is based on a parameter query which prompts for a OrderID and then displays the report. Now rather than having to prompt the user for the OrderID (which by the way is on the subform currently displayed). I want it to reference this ID field so that the user doesnt have to be prompted.

Here is how I thought I could do it:

Private Sub btnPrintRec_Click()
On Error GoTo Err_btnPrintRec_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "PrintOff"
srLinkCriteria = "[PrintOrderDetails].[OrderID]=" & Me.[frmOrders].[OrderID]
DoCmd.OpenReport stDocName, acPreview

Clearly Im way off the mark, so any pointers would be greatly appreciated

Thanks

Rodmc

I am in need of a module that will allow data from one table to be exported to multiple text files to one central directory. The determining factor on where creation of a file ends and a new one begins will be based off one field.

Example would be Field 'ACCT_NBR' has only a possible 50 unique values with thousands of records associated to each Account Number. Mainly I am in need on how to code a loop based on a field in a table and then export a text file by each unique value. File naming convention can be the Account number with time stamp.

I look forward to any assistance that I can get!

Hey guys,

I am basically trying to show different columns based on information in 1 of my tables.

So for example if the data = 1, then show these columns, if it equals 2, show these different columns, if it equals 3 show different ones again.

I have been trying to use the IIF() function to do it but haven't had any luck so far. This is the code i have been trying to use:


	Code:
	SELECT IIF(membership.Goals="Lose Weight", 
(table1.Cardio), IIF(membership.Goals="Get Fit", (table1.Cardio, table2.Muscle_building_exercises)), 
(table2.Muscle_building_exercises)

FROM membership, table1, table2
WHERE membershp.membership_no=[membership number?]

Note i have been making a gym database and i want it to be able to show different exercises based on the person's goals.

Hi can someone please help me out here.

I would like to hide or display 3 text boxes based on a value in 1 combo.

Lets say the values in the combo are 1;2;3
And I have three text boxes called a, b and c

If I select 1 in the combo box I would only like text box a to be diplayed.
If I select 2 in the combo box I would only like text box b to be displayed.
If I select 3 in the combo box I would only like text box c to be displayed.

Is this possible?
If so, how would I go about doing this?

Sorry if this is an easy on, I'm very new to access and just getting to grips with it.

Many thanks in advance.
Dino

I have seen similar threads to what I am trying to do, but nothing exact. I am trying to enable one field based on the value from a combo box. I can get the logic to work, but only if the record is saved or if I hit the Refresh All button on the ribbon bar. My situation is that the data is not yet saved to the database.

My details are:

ItemFrom = Name of Combo box
LitType = Name of field to be conditionally enabled based on value from ItemFrom
Litigation = value from ItemFrom combo box for conditional enabling to be activated

I have the following EventProcedure set at the form level

On Current
Private Sub Form_Current()
If Me.ItemFrom = "Litigation" Then
Me.LitType.Enabled = True
Else
Me.LitType.Enabled = False
End If
End Sub

Again, I can get the action I want IF I press RefreshAll. I have tried to set a me.refresh in other event procedures for both the ItemFrom and LitType fields...but I cannot get the refresh I want.
PLEASE HELP!!!!!

Hi Guys,

I am trying to select a record based on the value of a combo box, I can't use the wizard as I have code that currently lets you select the value and registers for later, I want to then use that value to open a record.

Below is sample code for the selection and combo box, the box is called results just to clarify.

I know this code works but I now what it to open a record when I select the value, any help would be great.

Private Sub Results_Click()
Dim x As Integer
Dim result As String
Dim strSQL As String

For x = 0 To Results.ListCount - 3
If Results.Value > 0 Then
result = Results.Value
strSQL = "SELECT [Customer Name] FROM Customer WHERE [Customer ID] LIKE '*" & str & "*' OR[Customer Name] LIKE '*" & str & "*' OR[Customer Address] LIKE '*" & str & "*' OR[Customer City] LIKE '*" & str & "*' OR[Customer Post Code] LIKE '*" & str & "*'OR[Customer Region] LIKE '*" & str & "*' OR[Customer County] LIKE '*" & str & "*'OR[Customer Country] LIKE '*" & str & "*' OR[Customer Telephone No] LIKE '*" & str & "*'OR[Customer Date of Birth] LIKE '*" & str & "*' OR[Customer Type] LIKE '*" & str & "*'OR[Payment Method] LIKE '*" & str & "*'"
DoCmd.RunSQL (strSQL)

End If

Next
End Sub

Hi, i wanted to run a query to select second column based on first column from same table..

For example

Column1 Column2
1 a
2 b

Column2 value should be base on Column1 value, that is Column2 value retrive from based on column1 value

Hi wonder if anyone can help.....

Am trying to filter a query based on whether a check box is selected or not. I've included the criteria row from my Query....

IIf([Forms]![frmfunctionlocation]![rbexcludeBIF]=-1,Not Like "BIF",Not "")

I read this as... if the check box(rbexcludeBIF) has been clicked(=-1) i want to not include the string BIF in my query. Else i want to include all fields(i.e not blank)

I think this is nearly right...but at the moment the query returns a blank screen!

Any ideas?

how to update a column based on the values of other columns?
IdNo RevId MinorRevId Status
789 A a ?
789 B b ?
890 0 a ?
890 0 b ?
890 1 b ?

status is the column used to find the latest Revision id, hence the rule is
for each Id,
Check RevId higher value ( Either B from A,B series or 1 from 0,1 series )* value may be in A,B... series or in 0,1... series
and
Check MinorRevId higher Value ( b from a,b)
and update the status to "Y" for tht record alone.
and for the other records need to updated as "N".
hence the above table will be
IdNo RevId MinorRevId Status
789 A a N
789 B b Y
890 0 a N
890 0 b N
890 1 b Y
For example in case a new entry comes,
IdNo RevId MinorRevId Status
789 A a N
789 B b N
789 B c Y
890 0 a N
890 0 b N
890 1 b Y
the contents should be modified as shown above..

Can someone tell me how to achieve this..
Thank you for your time!!

Hi
Whilst I know how to open a form based on the value selected from a combo box (selecting a client) on a switchboard, I then want the second form to have a combo box (based on the selected value from the combo box on the switchboard , i.e. the contacts for the client) and to then be able to open a third form to enter jobs set by the contact person (of the client).
The db structure is
1 client to many contacts
1 contacts to many jobs

thank you in anticipation

how to update a column based on the values of other columns?
IdNo RevId MinorRevId Status
789 A a ?
789 B b ?
890 0 a ?
890 0 b ?
890 1 b ?

status is the column used to find the latest Revision id, hence the rule is
for each Id,
Check RevId higher value ( Either B from A,B series or 1 from 0,1 series )* value may be in A,B... series or in 0,1... series
and
Check MinorRevId higher Value ( b from a,b)
and update the status to "Y" for tht record alone.
and for the other records need to updated as "N".
hence the above table will be
IdNo RevId MinorRevId Status
789 A a N
789 B b Y
890 0 a N
890 0 b N
890 1 b Y
For example in case a new entry comes,
IdNo RevId MinorRevId Status
789 A a N
789 B b N
789 B c Y
890 0 a N
890 0 b N
890 1 b Y
the contents should be modified as shown above..

Can someone tell me how to achieve this..
Thank you for your time!!

Hello all,

Need a little help as the 100 or so permutations I've tried still have not yielded satisfactory results. We've built a table where arrive time based on offices are being tracked. We've been able to count the number of arrive times by day of week and by office.
What we would like to do is pull up the expected arrive time based on the time, the number of occurrences and the office name.
Here's what I've been able to do so far, but can't figure out how to pull the time based on a single office name and max number of occurrences(or if two entries for the same office are the same to pull the earliest time)

Here's the code:
Code: SELECT First(TimeIn) AS FirstTimeIn, Max(CountOfRecordID) AS MaxCountOfRecordID, Max(Office_Name) AS LocationID FROM RuntimeAVG WHERE DayofWeek='Friday' AND CountOfRecordID1 GROUP BY TimeIn, Office_Name ORDER BY Max(Office_Name), Max(CountOfRecordID) DESC , First(TimeIn); Here's the results so far:

FirstTimeIn MaxCountOfRecordID LocationID
06:30 7 Office 1
06:45 3 Office 1
07:15 7 Office 2
07:00 6 Office 2
07:30 6 Office 2
09:30 2 Office 3
10:00 2 Office 3
07:30 3 Office 4
08:15 3 Office 4
07:45 2 Office 4
08:00 2 Office 4
08:30 2 Office 4
09:15 2 Office 4
10:45 2 Office 4
05:45 5 Office 5
06:00 2 Office 5

Any help is greatly appreciated.

I am trying to populate a footer based on field values in my report. I have set up an on activate event to loop through the controls and examine their value and then populate a continuos string. So far it ain't working any other ideas?

Hi,

I'm new with macros and am trying to cut rows from sheet2 to a new sheet based on the values in column a. In Column A there are numbers (1-however many...sometimes 5 sometimes 80) and i want each number to be on its own tab (there are five columns of information for each row...not sure if that matters or not). Each number may have multiple rows associated with it so i would like to cut all those rows and paste them into a new sheet.

Can anyone please help??


Not finding an answer? Try a Google search.