I'm new in access database. I have a form which the user have to input data. I have two textbox (wbc and txt1). wbc is a bound textbox while txt1 is unbound textbox. Wbc values must be between certain range I.e between 3.5 and 9.5. I want that if the user input a value below 3.5 then txt1 show the text 'Low' automatically or if wbc contains a value greater than 9.5 then txt1 show the text 'high'. But if wbc value is between 3.5 and 9.5 then txt1 will show nothing. I don't know how to go about this. Pls help me out.
You can add a macro to the AfterUpdate event on Wbc.
This macro checks the value of Wbc and changes the value of txt1 if Wbc violates the rules you mentioned
Macro image
Related
I usualy don't work with HTML, however I have a input textbox where a number can be enterd but I need the value to be in milimeters. Is it possible to have a textbox input field where the user can type in a value and the textbox will always show whatever number is typed in the textbox and mm apears after the number even as it is typed...
So as example the user enters the textbox types in 1000 and when they leave that textbox the text changes automatically from 1000 to 1000mm?
I have a form that takes in a class number, and then displays the class roster for the given class.
I am new to Access, so this may be a simple question, but how can I use a Button that is called Find Class that can be pressed so the user can change the class number?
Right now, I have ClassNbr as a field in my query, and then I am using that field in my report as an unbound textbox. It has a default value that is automatically displayed when the form is opened. Is there a way I can use a button to edit this ClassNbr field?
I have three combo box controls(MFG, Code, and GrpID) in my VBA access form. Once the user selects an option from the first combo box (MFG), rest of combo boxes give me available options. But I need to do some validation i.e. what if the user decided to change the value of first combo box? The values of rest combo box should be cleared. All I need to do is once the first combo box is changed the second and third combo box need to be cleared out or at least set to focus on them so that users will realize that they can't use old values as first value is cleared in the first combo box. I added a code block 'AfterUpdate for first combo box as shown below:
Private Sub MFG_AfterUpdate()
Code.Value = " "
GrpID.Value = 0
End Sub
The problem after writing above code is: they don't get empty until they(Code and GrpID) get clicked. In other words, I need to click them to empty them every time I change the value of MFG. Can anyone direct me how do I clear them or at least focus them?
Set the combo to null to wipe any displayed value in them;
Me.Code = Null
Me.GrpID = Null
This assumes your combo controls are called the same as your field names.
Edit for clarity: Including the Me. makes sure your are changing the form control values. If your field names are the same as the controls then Access will change the underlying field values, and as you have discovered on your form these aren't reflected until you click in that fields bound control.
I have a form in Access with a textbox and a combobox, and need to filter the combobox dropdown options using the value in the textbox. The textbox contains a Category for the choices.
I've done this using
SELECT Options.Choice
FROM Options
WHERE (((Options.Category)=[forms]![FormName]![Text10].Value));
Is there a way to refer to the value in Text10 without explicitly referring to FormName?
I'll need to duplicate this form within the same Access file and changing all combobox row sources for a new form is not feasible. I can't hard code the Category value for each combobox because there are many comboboxes per form, and the value in the textbox will be different on every form. Any help is appreciated.
You can refer to whatever form you're currently on in Access using Screen.ActiveForm. So in your case you'd have:
SELECT Options.Choice
FROM Options
WHERE (((Options.Category)=[Screen].[ActiveForm]![Text10].Value));
As long as the field name stays constant this should work.
I have an unbound text box on my form which the admin can enter a date of when records were last updated. I want this date to be copied to a label after pushing a button so that it holds the date instead of it do disappear after closing the form.
does anyone know if this is possible and how it is possible?
For creating a variable that can be used AFTER the form is closed:
Create a new module (in code window, click 'Insert | Module'
Insert the variable name(s) and types you want available everywhere. i.e.
Global dtLastUpdated As Date
Global strSaveSomeName As String
Save the module as mdl_Globals
Add code wherever needed to set the variable, then can reference anywhere.
If for use during the form, use the following: where 'lblForUnbound' is the Label field and 'txtUnbound' is your unbound text box
Me.lblForUnbound.Caption = Me.txtUnbound.Text