Expression in control source and default value - ms-access

I am pulling my hair here.
I want to link 2 subform fields to a field in the main form.
I used Parent.MyFieldName.Column(3) for the control source of the first subform field and it is displayed fine. The Row source of my second subform field is using the first subform field as a criteria for its query.
The problem is that this combobox remains empty when I use the above code but is populated if I give the first field a constant value.
Feels like the combobox is getting filled before the retrieval of data from the first subform field.
I tried moving the above code form control source to default value but then both fields remain empty.
What am I doing wrong?

I have found the main reason why things weren't working - Subform controls load before the rest of the main form. This means that at the time my subform dropdown menu seeks the data in the other form fields they still haven't appeared and thus I am left with an empty dropdown menu.
I solved this by removing the sourceobject of the subform control and adding
Me!Subform1.SourceObject = "SubformOtpuskaneIzhMat"
In some events in the main form.

Related

Subform doesn't recognize textbox source after reopening file

I have one main form with a subform and two date text boxes. The subform has been connected to the query with a date value column. I put criteria in query Between [Forms]![frm_mainform]![txt_from] And [Forms]![frm_mainform]![txt_to]. Also, both text boxes have Default Value set as =DateAdd("d";-30;Date()) and =DateAdd("d";30;Date()).
So, it works fine until I close the document and reopen it. After that subform doesn't recognize text boxes and lanch me entry boxes for both values.
Data entry form pic
After I change just one letter in Name it works again, and when I close the document again it lost it again.
Is anyone familiar with this behavior?
I have put Me.Refresh on Form_Load() event and it fixed it.
Still, I don't know what causes such behavior.

Requery of subform does not activate conditional formatting and puts new record at the bottom

I have a form with a 2-page tab control.
The first page has a subform with a button on the subform that's supposed to requery another subform that is on the second page.
Forms!myMainForm!mySubForm.Requery
The main form and its fields are used to create new records and the subform on the second page shows these records.
Here's a screenshot of page 1's subform and button:
http://i.imgur.com/RLsgcSi.jpg
When the button is clicked, the subform on the second page shows any new record at the bottom of the list instead of being sorted in descending date/time order. Also the Funding Rate field does not seem to get its conditional formatting applied:
http://i.imgur.com/QRvI5fy.jpg
I've been able to get the subform to display correctly if I also add some VBA to the button to switch to the second page of the tab, but I'd rather not do this.
Is it possible to requery a subform and have it display correctly when the user is ready to see it?
Migrate froms Tabs to Navigation Control. Usual Tabs are preloaded and will increase the main form load time. On the other hand, Navigation control only loads the form when its opened. This eliminates your needs to manually re-query the second tab.
PS: I'm interested in something in your form, what is your best contact method?
Forms!myMainForm!mySubForm.Requery
This requeries the mySubForm control on myMainForm, but not the subform itself.
Try instead:
Forms!myMainForm!mySubForm.Form.Requery
(note: I'm not 100% sure this will solve the issue)

MS Access combobox in a continuous form changes value for all rows when I change value for one row

I've been trying to solve this issue for the past 2 hours but in vain...
So I hope that you can help me with a solution to this problem..
I have a continuous form that shows many rows at a time, I added a combobox to the form that shows some values to choose from another table, while having the default value shown from the same table. Problem is, as soon as I change the value in one of the comboboxes in the form, all the other comboboxes changes value to the same one as the latter...
How do I prevent that??
Thanks a million in advance
Tony's right. You can't do what you want with an unbound control.
However, it's not entirely clear what your intent is based on your question. If changing the combobox should update a field on the current record, then you just need to make it a bound control. You would do this by setting the combobox's ControlSource property equal to the appropriate field in the underlying table or query.
I faced similar issue and got it sorted recently. I had created a tabular form and had introduced a combo box in the form, picking up values from a value list. Whenever I used to select a value of this combo box list, the selection used to get reflecting on all the records. To correct this, you should do the following:-
1) Introduce the combo box field in the source table of your form. Instead of clicking on the drop down box in the tool box, click on the Add existing fields link on the ribbon and select the newly added combo box field from the table. This will add a combo box field and a corresponding label in the form area. For a tabular form, you may want to delete the corresponding label and introduce a non-linked label in the form header.
This solved the issue for me. Hope it will be of some value to you.
May be a couple of years late and am pretty sure that it's been long since you figured out this problem,but it's good to leave it in the thread for someone,who may be in need.
Can't be done. This is one of the limitations of Access continuous forms and unbound controls.
Because of this strange behavior I just hide that field.
In the datasheet view:
Right-Click the field header that matches your combobox
Select "Hide Fields"
Now the person can see the records and they can use the form. They don't need a field for the combobox.

How to open a form in Access, automatically select a value in a combobox and display the detail?

A user can select a value in a combo box and the detail automatically loads into the forms fields. How can I automatically select a particular value when (or after) opening the form and get the detail to load?
I've managed to set the value of the ComboBox after opening the form, but the detail on the page doesn't change until I manually select a value in the ComboBox.
Is the subform built with code or more simply by setting the link master field to the combo and the link child field to the matched field for the bound column? For the most part, the second way is best as it does not require the After Update code for the combo to be triggered, which won't happen when the value is set via code.

Access: Dropdown doesn't display value in first record of continuous subform

I have a continuous subform in an Access 2003 form. The first control on the subform is an unbound dropdown box. When the form (and subform) are opened the dropdown on the first record receives focus, but the text is blank (just a blinking cursor). If I click on any other record, the first record's dropdown text then display the correct value (and the record I clicked on does not go blank).
I tried the following line
Call DoCmd.GoToRecord(acDataForm, "DetailsSubform", acNewRec)
in the both the main form's and subform's Load, Open and Activate events with no luck. Either I get an error that the subform isn't open, or there's a conflict with the routine that populates the dropdown.
I'm looking for a way for either the dropdown to display its value, or simply jump to a new record (my client would prefer the latter but can live with the former). More information can be provided if needed, I just wanted to start with an overview. Thanks.
You probably need the current event. Note that an unbound control in a continuous subform will display the same value for all records.