How do I lock/unlock a recordID so that it can be carried over onto a new
form or a report?
I cannot seem to open the forms or reports with the displayed main form
information.
I'm not sure what you mean by "lock/unlock a recordID", but if you are trying to
open FormB from FormA to display a record sharing the same key value, then the
following approach using the "OpenForm" method and its "WhereCondition" argument
should work
'If the key value is an autonumber or other number
DoCmd.OpenForm "FormB", , , "recordID=" & Me!recordID
'If the key value is text
DoCmd.OpenForm "FormB", , , "recordID=""" & Me!recordID & """"
Just make sure that the record is saved (especially if it's a "new" record -
just check the "Dirty" property of the form and, if True, set that property to
"False" before issuing the "OpenForm") and note that if FormB is to contain data
from a table other than that in FormA, that table must contain data with a
matching key or FormB will open with an empty recordset.
If you are trying to generate a new child record to be related to the "main
form" record, this takes a slightly different approach. Let us know if this is
what you are trying to do.