where should I put the code? In the FORM B or in FORM A? about the [yourformname] and [yourfieldname], what formname and fieldname should I put?
Put it in the Criteria row of the Query design grid.
This might help explain things.
Let's say Form A has Query1 as its record source and Form B has Query2 as its record source.
Query1 for FormA might have different Criteria that you have added so as to select records from the table the query is based on.
Query2 only has one Criteria and that is [Forms]![FormA]![The field/texbox name on FormA] that you want Form B to open for a matching record or records.
Let's say you want Form B to open to match the person who is displayed on FormA. In that case you would use the ID field you have.
We will say the person on Form A is John Smith and his ID is 12345. If Query2 that supports FormB has in the Criteria for the ID field [Forms]![FormA]![IDField] then Query2/FormB will act exactly as if you had
e entered 12345 in the criteria of Query2 for the ID field. In other words it gets it Criteria from the open record in FormA
If you changed the Criteria in Query2 to lastname and thus [Forms]![FormA]![LastNameFiled] that might show more than one record in Form B because you might have more than one Andrews.
If you wish to insert data from FormA to FormB then that is different. However, the above is one way to open Form B at the desired record, which might be required before inserting data unless you want to insert eh data into an unbound textbox on FormB.
Code would look like Forms!FormB!NameNumber = Forms!FormA!NameNumber
In a Macro it is SetvValue action and Expression is [Forms]![FormA]![NameNumber] and the Item is the FormB one also with the brackets.