Filter form on open based on value in linked subform - ms-access-2007

I have a basic search page, user selects one or more values from a range of options, these are used to build a string which is then passed as the filter when the form is opened so that only the appropriate records are displayed. The form itself contains a subform.
Up to now the searching/filtering has been based on controls in the main body of the form, but I now need to be able to search one of the fields in the subform as well. Is this possible, and if so, how?
NB. I've tried executing a query to return a recordset that has the primary key of each of the records in the form I want to display but stuck on the best way to use the results. If there is only one result I can pass it as a string and it works fine, but how to handle multiple values?

Related

How can I jump a form to a specific record in Access?

I have an Access Form which pulls records from a table. The user will interact with the records, sometimes in chronological order, and sometimes by jumping direct to a specific record.
The table uses a field called ID as the primary key which auto-numbers when a record is created. This is what the team will use to jump directly to a record.
I need to create a textbox where the ID number can be inputted and then a button to carry out some code to jump to the specified record if it exists.
I have attempted to put bits of code together what I have found online but so far have had no such luck in making anything work.
I would be very grateful if anybody could advise me and provide a code sample to make this work! :)
Make use of the RecordSetClone and Bookmark properties.
Use the RecordSetClone property to obtain a copy of the form's recordset that you can manipulate without affecting the "live" recordset used by the form.
Locate the appropriate record in the cloned recordset (perhaps using the FindFirst method), and obtain the Bookmark which uniquely identifies such record in the recordset.
Set the Bookmark property of the form to the Bookmark value obtained from the cloned recordset in order to change the current record displayed by the form to the record found.

Prevent all Access Form ListBoxes from updating

I have a form that gets populated with rows of data from a database. I want to add a listbox to each row for the user to select a letter grade. When I run the form all the data looks correct, but if I update a single listbox all the listboxes in the form update to the same value. It seems like the listboxes aren't independent of each other.
An unbound control will always display the same on all records.
For individual display, you must bind it to a field of the record - or redesign your form in some way.

VBA access and forms

I created a database in Access and there are some type of records in some tables that requires a particular inserting, so I decided to use VBA to handle this.
The problem is that if i create a form with some controls which i want to refer and use their values as criteria for queries, the form is still a way to insert data. So the query works but the data i inserted are added directly from the form too, creating duplicates.
The question is, is there a way to create a form that has controls only for text input but does nothing to record , leaving inserting, deleting , updating all to queries in VBA?
I tried to put "no" on propriety "add records" in the form but it gets totally blank with no controls.
Your form must be unbound, i.e. its RecordSource must be empty.
Your form can be bound or not bound to a table / query.
This means that the controls on your form may be bound to a field of that table / query.
But you can also have controls in the same form which are not bound.
Example:
You can make a form in which the body has a list view of the records of the table. In this section the controls would be bound to a field.
In the header of the table instead you may have controls that are not bound and that could be used either to filter the records shown or to add new records. You may want to add records this way rather than let users insert data directly in order to add checks or do any other kind of processing before actually adding the data in a new record.

Trying to open another form in Access based on a field in the current form

I have a form that's just a list of descriptions (desc.) of other forms. Right now, when you click on a desc., the appropriate form opens; but it's done through a series of if statements in a macro. This isn't going to scale well once more forms are created.
I have a table that has the desc. and the form that is supposed to go to. I want to write a script that uses this table to open the new form based on the desc. clicked, but not using if statements. The end goal is to be able to just add a row to the table for any future forms that are created without making changes to the script or form. Is there a way to do this?
Use a combo box whose row source is a query which selects the form description and name fields from your table.
The combo will have 2 columns. You can set the width of the form name column to zero if you want to present only the form descriptions. If you make the form name column the combo's bound column, you can reference it conveniently in a DoCmd.OpenForm statement. For example, you could have a command button whose click event opens the form which is currently selected in the combo ...
DoCmd.OpenForm Me.YourComboName.Value

Individual Record Subform

I am fairly new to access and I am wondering about a form.
In my form, I want to have certain field values displayed based upon which row the user selects.
So, pretend a user selects Row B, I want a subform that displays data from only Row B.
Is this possible, and if so how? :)
Thanks!
You don't even need a subform for this.
Your main form is a continuous form and your data rows are displayed in the form's detail area, right?
If yes, you can just put bound textboxes in the form header or footer, and they will display the value of the selected row.
Here are some example screenshots I just made.
It's Access 2000 and it's in German (that's the only Access version that I have here), but you'll get the idea.
Design mode:
("Formularkopf" means "form header", and "Detailbereich" is "Detail" in English Access versions.)
At runtime:
Note that the textbox in the form header, which is bound to Field2, automatically displays the value of Field2 in the currently selected row.