I am having a mare trying to do something which I think should be quite simple, as follows.
In a table I have the field [Entitled]. On my form I have this as a yes/no check box.
I have the following code in the VB.
Private Sub Check112_AfterUpdate()
If Me![Check112] = True Then
Me![Entitled].Visible = True
(or I could use) Me![Entitled].Enabled = True
Else
Me![Entitled].Visible = False
(or I could use) Me![Entitled].Enabled = False
End If
End Sub
Some people have the field checked and others do not.
The problem is; when I check or uncheck the box on individual records shown on the form, the value is remebered when I scroll to the next record (i.e. the box may be unchecked but the field is still visible/enabled). It is doing my head in! Help Please.
I have a form with four subforms set up in a tabs on the form. In the subforms I have a copuple of command buttons which enable/make visible fields when they are clicked (see previous posts but for eg) - if a height and a weight are added in two separate boxes a calculation is done and then a command button pressed to make visible the (label) which shows the mass index the patient falls into. My problem is that the label is then retained so if I click out of the form and re-enter with a new patient then the height and weight boxes are clear but the label from the previous patient remains.
I tried to put the code Private Sub Form_Load() If PtWeight = Null And PtHeight = Null And Text60 = Null Then Label106.Visible = False Label101.Visible = False Label177.Visible = False Label122.Visible = False Label123.Visible = False End If End Sub in both the open and on load event of the main form (not the subform) but it doesn't help. Any ideas?
(When should code be put on the main form and when on the subform?)
I'm trying to get a check box to be visible/enabled on Tuesdays, Thursdays and Sundays. I've been dabbling with the code and 'DatePart' but with little effect. I've been trying other suggestions on other threads but am still struggling I'm afraid. All help much appreciated, and I'm fairly new to access and have a large work objective to cope with, see below for my poor effort so far
Private Sub Datapulse_Enter()
If Datapulse = DatePart("1", "3", "5") Then Datapulse.Visible = False Else Datapulse.Visible = True End If
I'm trying to check if a subform is visable. The following code is just test code so I can get a result. I keep getting an error on the .IsVisible section.
If datTimePlus15 <= datCurTime And [frmBarstockAreaSubForm].IsVisible Then MsgBox datTimePlus15 & " " & datCurTime datTimePlus15 = DateAdd("n", 1, Now) End If
On my switchboard form, I have a check box which the user can check to make a text box (which appears in several different reports) visible and uncheck to make it invisible. The text box in the reports has the same name on all of them.
I am having trouble making this work.
I can think of two solutions, but haven't had success with either yet.
1. I could simply change the visible property of the report(s) control from the form. This works if the report is open, but throws an error if the report is not open.
Code:Public Sub showNumOrgsInReportCB_AfterUpdate()If Me!showNumOrgsInReportCB.Value = 0 ThenReports![publishZipR]![numOrgsF].Visible = FalseElseReports![publishZipR]![numOrgsF].Visible = TrueEnd IfEnd Sub
Is there a property or function I can use to test whether the report is open before I set the text box visibility?
2. Alternatively, a less elegant solution would be to run an event procedure to close all open reports. This would eliminate that issue, but I haven't gotten the code to work yet:
Code:Public Sub showNumOrgsInReportCB_AfterUpdate() Dim rpt As Report ' Enumerate Reports collection.For Each rpt In ReportsDoCmd.Close rpt.nameNext rptEnd Sub
This line: DoCmd.Close rpt.name throws a Run-time Error '13', Type mismatch.
I have a combobox on my form called TypeOfBusiness, with fields including Corporation, Education, Industry, Non-Profit. In order to make a second combobox called IndustryClassification appear when Industry is selected from the TypeOfBusiness combobox, I have used the following code:
Code: Private Sub Form_Current() If Me.TypeOfBusiness = "Industry" Then Me.IndustryClassification.Visible = True Else Me.IndustryClassification.Visible = False
[Code] .....
It works just fine. However, when a user selects both, say, Industry and Education, the IndustryClassification combobox will not appear. What code I can use to ensure the IndustryClassification box will appear regardless if another box is checked in addition to Industry? I am wondering if it has to do with the Column attribute.
I have a Main Form with a Sub-Form, the sub-form is base off a query. on the sub-form i have 8 controls, one of them is "Status' and "Process" and "Review" My Main Form have a Refresh command that refreshes the data in the sub-form.
What i am trying to do is make the "Process" Control only visible is "Status" is a certain status and "Review" visible if "Status" is something else. what i have done works correctly On Open. I run into and issue on the refresh command. I get Run-time error '2165' "You can't hide a control that has the focus"
Code: If Forms!Main_Form.[Name subform]!Status = "Ready" Then Forms!Main_Form.[Name subform]!Process.Visible = True Forms!Main_Form.[Name subform]!Review.Visible = False ElseIf Forms!Main_Form.[Name subform]!Status = "Reviewing" Then Forms!Main_Form.[Name subform]!Review.Visible = True Forms!Main_Form.[Name subform]!Process.Visible = False End If
I have done similar with a main form and making sub-form visible or not based on a control on a main form and that has worked perfectly. I am not sure how the control is getting focus and cause the error.
Have a number of tick boxes on different forms. When the form is opened the tick box appears to be greyed out however it is enabled. Is there any way that these tick boxes can appear enabled???
After some suggestions, I have a form with combo boxes, the combo boxes are set to enabled "no", but become enabled by an after update command on another field.
The after update command works perfectly, however once enabled I need to ensure data is selected, as opposed to leaving blank.
I have a form with many command buttons. This form is a master for a database that keeps time for my department. One command button is a setup button that I want the user to run once and only once. What code, and where do I put it will allow my to set the command button's visible or enabled to be false. Even when the user closed the database and reopend it, if the user has run the setup once, I do not want to allow them to run it again.
In a simple data retrieve/update form, how I can set a text field’s properties Enabled to No based on that particular record value?
For instance, there are 4 fields, employeeid, employeename, employeetitle, employeephone I would like to set the employeephone text field’s properties Enabled = No, if the employeetitle is Manager
I want a combo box to be enabled only when I want to edit the data in the cbo for that particular record or when the fo0rm is on a new record. So, by default the cbo is Enabled No and Locked Yes. I placed a button on the form and put the following in the On Click:
Code:
Private Sub cmdEditContactsType_Click() Me!cboContactFilter.Enabled = True Me!cboContactFilter.Locked = False End Sub
But when I press the button the control remains disabled.The field has several Contact genres and since I'm using the data in a split form allowing edits to the single form side I don't want this cbo enabled during browsing.
I have a form for creating a new database record for a list of "components".
One button "add_component" adds a new record. One text input "component_input" allows you to enter in the "name" of the component. One button "save_component" saves the record.
The component_input and save_component have their default "enabled" property set to "No" in their properties list.
I only want the component_input and save_component form objects to be enabled once the "add_component" button has been clicked. Once the "save_component" button is clicked, I want them to return to being disabled. This will prevent any accidental over-writing of records.
I have used "build event" for the "add_component" button...
Code: if [macroError] <> 0 then ## errorMessage here ## else setProperty control name: component_input property: enabled
[Code] ....
And then I have used "build event" for the "save_component" button...
Code: if [macroError] <> 0 then ## errorMessage here ## else setProperty control name: component_input
[Code] ....
Now, this works when add_component is first clicked, however when I click save_component neither component_input or save_component become disabled again.
i have a problem i hope some one can help me with.
i have a form with a sub form on it, and i want to disable everything until the user clicks a 'edit' button to allow the information to be changed.
i am just testing it at the moment, so i set one text box's enabled property to false. then i added a button with an on click event with the following code:
Me!userid.Enabled = True
when i start the form, the userid box is disabled and when i click on the edit button, it enables it fine.
however, when i change to the next record, the userid box remains enabled. i cant find where to put the code to set it back to false everytime i change the record.
i should also let you know i am a beginner, so please be gentle!
I presently have a form that I have all the fields set as read only by using the enabled and the locked property of each field. However I have to be able to open the form to certain users with all fields enabled and unlocked. I need code that will run through each field and set the field's enabled to True and the locked to false. This code I will apply to a button that will open the form.
I created a database which when macros are enabled the only thing visible on the screen is the forum. All tables as well as the ribbon bar is disabled. I also disabled right-clicking.
My issue is, for those who do not have macro's enabled, it opens up in design view and allows access to the left-hand tables until the user clicks the trust button at the top. Once trust is clicked, everything hides as expected.Is there a way to restrict access if they do not have their macros enabled?
im creating a form in design view but the icon to show the fields from the table that i want the fields to come from isnt being displayed; how do i get it to show?
I am using Office 2007 and trying to export a table in Access to a Macro-Enabled workbook in Excel. Unfortunately, when I go to export the table, my file does not show when I browse for the file and .xlsm doesn't look like it's a supported file extension. I have looked around and noticed others have this problem as well. One solution was to use save the Excel file as a 97-2000 file since it doesn't change the file extension based on having macros. However, I can't do this because then I lose functionality with tables and other things on my spreadsheet. I need the data in Excel to be updated every month. Is there any way to do this in Access? I'm going to explore using sharepoint. My DB options are limited to Access and Sharepoint. I don't have access to Oracle or SQL Server or MySQL etc.
I have several buttons on a form and I want to set enabled = false on one of them when I open the form - that's fine
I have two txt fields - ReceiptNo and BankPaymtId if the both have a value I want to make the button enabled = True
This is the code I have used on the BankPaymentId On Dirty event
Private Sub BankPaymentId_Dirty(Cancel As Integer) If Me.[ReceiptNo] <> "" Then If Me.[BankPaymtId] <> "" Then Me.CreateOutlay.Enabled = True End If End If End Sub
This is the one for ReceiptNum on Dirty event
Private Sub ReceiptNum_Dirty(Cancel As Integer) If Me.[ReceiptNo] <> "" Then If Me.[BankPaymtId] <> "" Then Me.CreateOutlay.Enabled = True End If End If End Sub
I have encountered a strange side effect. I am enabling and disabling several controls (the cludgy way-one at a time) depending upon the presence or absence of data in a field, using the oncurrent event to decide. It works.
But! It also moves some controls. Most of the controls stay put. But all four datepicker controls move to the upper left corner of the form when the oncurrent encounters the conditions that make these controls enabled. When they are disabled, they show up in the right place. When I navigate from a record where they are disabled to a record with data where they should be enabled, they are enabled but moved. When I navigate to a new record and all fields are enabled, but in their proper places. Any suggestions? Here's the code (* are the offending datepicker controls):
I'm in need a of a check-in/check-out application for my company. We have about 550-600 employees at any given time and our turnover is about 20-30% per year. Our check-in/check-out process requires our employees to personally visit between 30-40 areas in our company (personnel, safety, credentials, parking, insurance, etc) within the first month of employment. This is currently done manually and is a huge drain on labor, especially when check-in sheets are lost, misplaced or, in some cases, forged.
I'm looking to build a database that would be intranet based, password secure (by check-in area) that would allow the new employee to present at a particular check-in, check-out site, complete that portion of the check-in/out process and then allow the person responsible for the check-in/out to enter the status into the database. At any point in the process, I would want to know the status of the person checking in/out (how long they've been checking in/out and what portion of the process have they completed).
I have one field called "Tax", when I open the form, the "Tax" is invisible, when I click one button, then the "Tax" is visible, after the input the value, I want the "Tax" to be invisible. But it cannot be invisible.
Private Sub Tax AfterUpdate() [Tax].Visible = False End Sub
This might sound simple to everyone, but it won't work for me. I have a text box on my form that holds the current date, there are also other text boxes that hold other information. Here's what I'm trying to do, if the other text boxes are empty then I want the date text box to be invisible. Here's the code I'm trying to use:
Code:If [EquipmentType1]=" " Then[DateSigned].visible = FalseEnd IfEnd Sub
By the way this is triggered from the Form Load event. Thanks for any help you can provide.
Hi I have sendkey "{f7}" on loss focus. this works great as a spell check but then I get the mesage box that spell check is complete. How do I stop this box from occuring?