How to automatically fill a form field? - vba

I would like to fill automatically a field when a certain value is selected in an other field. The columns concerned in my form :
I want when the value "Recrutement" in field [Nom Entreprise] is selected fill automatically field [Candidats Potentiels] with the word "Recrutement".
Should I create an event?

Related

Change default value of textbox to last value entered

I have a FORM (frm_Amounts) based on a TABLE (tbl_Amounts), containing three Text Boxes,
The first Text Box is (Amount_EUR) based on field value in [tbl_Amounts].
The second Text Box is (ExchangeRate). Its value is entered in the FORM.
The third Text Box is (Amount_US$). Its value is calculated by: [Amount_EUR] * [ExchangeRate]
Initially I will enter a value for [ExchangeRate]. I want that value to become the default value until I enter a new value for [ExchangeRate].
This new value will continue as the default until I change it, and so on.
When I close the Access database and reopen, I want the last value entered in [ExchangeRate] to be the default value for the [ExchangeRate] Text Box.
Use the AfterUpdate event of [ExchangeRate] textbox to set its DefaultValue property with value just entered. Subsequent new records will have that value until a new input or the form is closed. Changing Textbox.DefaultValue in Access
When opening form, if you want to retrieve the last value entered, that will require either saving that value into a special table for that purpose or doing a search of the actual data table to pull that value.

Control Source of a text boxes set to DCount function - Refresh issue

I'm setting the control source of text fields to return the value of a function (multiple fields with different filtering conditions). The form has a combo box with a list of years: when the user selects a specific year, the on change event triggers a refresh of all the fields.
My problem is the fields don't show any values unless after combo box's On Change events. I have to click on the form/fields before the values start showing up.
I tried to do form refresh & field's requery but doesn't work.
The text field's Control Source is set to:
=SummaryReport("Projects","G","1",[Forms]![frmSUMMARY_REPORT]![cmbYEARS])
What I'm trying to do is when the user selects a year from a drop down, the fields values are updated & displayed by the On Change event - currently they seem to be updated but are not showing unless I click on the screen and that's when values start showing up in each field.
The method to update calculated fields is Me.Recalc (or myForm.Recalc):
https://learn.microsoft.com/en-us/office/vba/api/access.form.recalc
Try this instead of .Refresh.
Also I think the better event to use is After Update instead of On Change for a combo box.

Add a field value to text box

I have an Access Table named Count. It has one field named Anz and it has only 1 record. I want to Show this record in a TextBox on a form named overview. So in the design mode of the form inside the TextBox I use the code
[Count]![Anz]
but it Returns me #Name? error when I Switch back to form mode. Where am I going wrong?
You can use in Control Source of your unbound text box =Dlookup("[Anz]","[Count]")
Also you can bound your form to Count table and use for text box control source Anz

show/hide fields based on selection in openerp 7

I have a selection field in openerp form
what I want is that when I select any value from this field , another field (which is hidden or invisible ) is shown automatically , based on the selected value.
I know that it is possible to show or hide a field checking or unchecking a boolean field in your view (e.g. needs_moreinfo).
<field name="moreinfo" attrs="{'invisible':['needs_moreinfo','=', false]}" />
I guess you could do the same, based on the IDs of the elements of your selection field. But it has to be hardcoded and you have to know in advance the ids in you DB...

dijit.form.Combobox show label Instead of value

I've a dijit.form.Combobox field which uses a ItemFileReadStore to pull Its data.
Teh ItemFileReadStore has two attribute per Item value which will be used for form submission , generally Unique Integers and label which is Human Understandable String.
In ComboBox HTML I've done searchAttr="value" labelAttr="label"
When the ComboBox Shows the list it uses teh label Attribute.
But When the User selects one of the Item it shows the value of that Item.
What I want is , The value Attribute will Still be used for Form Submission. But the User will always see the label in the combobox Control.
alt text http://img822.imageshack.us/img822/6660/dijitcombo.jpg
e.g. I Want to Show The Label for value 3 (Admin) instead of 3
Use FilteringSelect instead of Combobox.
Note: ComboBox only has a single value that matches what is displayed while FilteringSelect incorporates a hidden value that corresponds to the displayed value.
I have tried the following.
var cmbObject = Registry.byId('combo dojo id'); var id =
cmbObject.item.<Code Property>;
You should check if item is null.