Mainform: has read only textboxes that reference a table (tblEmployee) that will hold flatfile upload data.
Subform: linked to "ID" field in tblEmployee table. Subform input data would input to tblEmployeeChangeover table. Subform is acting as an "update" tool. A user would look at the mainform, and if data needs to be updated, they would interact with the subform to do so. This is so tblEmployee is not modified, and the tblEmployeeChangeover can be used to email the new data only and also be used to run reports.
Both forms:
--have a field named ID, which is what they are supposed to be linked on. For example, if the flat file has ID of "3", then the subform should be "3" as well.
--Field names are identical for both main form and sub form, except subform has "_changeover" on them. So ID is ID for both forms. But "EmployeeSchedule" on Mainform is "EmployeeSchedule_changeover" on subform table and textboxes.
Problem: upload of flatfile seems to be fine. Need to be able to input data in subform that will be saved to tblEmployeeChangeover table. Whenever I try to input data into the subform and advance to a new record in the mainform:
-cannot input ID in ID textbox in subform
-which means data in subform is not linked to mainform textbox data
what do I do to get the subform to go to a "blank" form when the "next record" arrow is clicked on main form?
what do I do to make sure that the data is saved in the subform table when subform is updated?
If further info is needed, let me know.
Thanks,
PAT2B
Related
I have a form that is meant to change records or add new ones. On the same form I have subform datasheet of the same table so I can look at all the other records besides the one I am changing/creating. I would like the two (form and subform) to connect in a way, that when I for example move to 5th record in the datasheet subform, that record would be shown in my main form automatically.
At the moment I have it all set in a way, that when I lets say start a new record in my main form, data is automatically updated in the datasheet too, and that is when I change any field in the main form. That way I have live data in both, main and subform - I've done that via
Private Sub Field1_AfterUpdate()
Me.Refresh
End Sub
for every field. And that means that whenever I change any field in my main form, in my subform datasheet the first record automatically becomes in focus because of that refresh.
Form and DatasheetSubform
Any suggestions how to fix that?
I want help in creating a pickup list in which there is a list of choices you pick and corresponding to the choice you choose the secondary form loads with its own listed fields.
EG. I have created 3 tables (Brand, Toyota, BMW), and each table has its own set of fields in them.
I want to Open Main Form(Brand) and create a drop-down list that shows Toyota and BMW). when I choose Toyota it should open the Toyota form as a subform inside the Brand Form and the same goes for when you choose BMW. I am new to access and would really appreciate anyone's valuable input.
I also reccomend "normalizing" to a single table with a "makeId" column and a "make" table. But it is possible to do what you are asking in Access if both the "Toyota" table and the "BMW" table have the same columns:
Create a datasheet form with the wizard based on either table.
Create a blank form with a combo box and subform control.
Set the source of the combo box to your "Brand" table.
Set the source of the subform to your datasheet form.
Change the recordsource of the subform on the combobox change event:
Private Sub brandBox_Change()
subform.form.RecordSource = "SELECT * FROM " & brandBox.Value
subform.Requery
End sub
I don't recommend it but is possible.
I have a very simple form with a combo box that is populated by a query. A user selects the class for which they want to enter data from the combo box and the records (passing the selection from the combo box to another query) for that class are loaded into a subform.
However, when multiple users are accessing the database and another teacher selects another class from the dropdown and starts entering data, the subform for the first teacher requeries and brings up the class selected by the other teacher.
How do I avoid this?
I have split the database into frontend and backend.
It would seem that the combobox for selecting the class is bound to a field in a table. That is why it is updating for one user when another user makes a selection.
You should make this combobox unbound (=clear the ControlSource property).
It is not clear to me if you are already doing this, but the correct way of filtering by a field (class in your case) is to set LinkMasterFields (of the subform control) to the name of your combox control and LinkChildFields to the class field in the the underlying recordset of the the subform.
I have two sub-forms on a main form in access 2010. I want it to be that when I select a record in one of the sub-form, the other sub-form shows a related field.
For example, when A record (date) is selected in one sub-form, The notes (a memo field) should display in the accompanying sub-form.
What it is that I have a table that users make notes in one field is for the date and another is for the notes. I want to create a sub-form that displays only the notes (form B) when the date is selected in a sub-form (Form C) on the same form (FormA).
I need it this was as the main form allows for users to search for some values whic will populate Form C.
In the OnUpdate event, just reset (or refresh) the record source of the subform with the notes. I'm assuming the notes subform has a recordsource that is a query?
I have a list box on an MS Access 2010 form that has its contents generated by a query. The list box lists new customer names; these names are the ones that are not listed in the Customers table in the DB.
The user can select a customer name on the list box and click a button to add that customer name to the Customers table.
Now, after the new customer is added to the Customers table, I want to refresh the table, i.e. I want to re-run the query that generates its contents. Is there a way to do this in VBA or by setting a property?
Thanks! :)
Listboxes, comboboxes, and forms/subforms have a Requery method that should refresh/requery/reload the underlying recordset.
Me.Requery 'Requery Form
Me.Listbox1.Requery 'Requery Listbox
Me.ComboBox1.Requery 'Requery ComboBox
Me.SubformControlName.Form.Requery 'Requery a subform
Choose the correct one above and change it to match the name of your control. I think you should put it at the end of your code on your button_click() procedure. In some scenarios you will place this code on a control's AfterUpdate event.