How to get rid of blank line in a Subform w/in Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to get rid of the blank row in a subform (created using a
query) that's residing within a main form? It is the row that has the * but
is showing up as a blank line.

Also, if I am linking the subform in within the main form using a primary
key, but only displaying 3 out of the 5 fields, can I update these fields
within the main form if the subform is based on a query (relating 2
tables-one of which is pulling a description from linked on a primary key)?

Thank you,
geri
 
The line you mention is for a new record. If you aren't going to enter new
records, you could set the Allow Additions property of the subform to No
(Data tab, Properties dialog).
 
Thank you! Is there any other way to get rid of the "add" line? I will need
to add records periodically.

One more question please.....
Also, if I am linking the subform in within the main form using a primary
key, but only displaying 3 out of the 5 fields, can I update these fields
within the main form if the subform is based on a query (relating 2
tables-one of which is pulling a description from linked on a primary
key)?

Thanks for your help.
 
Comments inline....

--

Ken Snell
<MS ACCESS MVP>

gg said:
Thank you! Is there any other way to get rid of the "add" line? I will
need
to add records periodically.

The only other way is to use a nonupdatable query...which means that you
will not be able to add new data, edit new data, or delete existing data.
So, no. But you can turn this property on and off via VBA code, so you can
do what you wish -- namely, add new record at some point, then get rid of
the blank record.

One more question please.....
Also, if I am linking the subform in within the main form using a primary
key, but only displaying 3 out of the 5 fields, can I update these fields
within the main form if the subform is based on a query (relating 2
tables-one of which is pulling a description from linked on a primary
key)?

You'll need to give more specifics about your setup.. this is too generic to
give a plausible answer.
 
If I have a subform within the main form and the source is a query that links
2 tables: 1) Table1 Contracts table - has the contract_no (i.e. 27) and a
document_type field (OA) and 2) Table2 - document_type field (OA) and a
document_description field. Can I add a new document_type (A1) record and
document_description in this subform even though it was built from a query?

Thank you!
gg
 
If the query is updateable, the subform will be also unless you have set
Allow Edits and/or Allow Additions to No. If you set Allow Edits to No on
the main form, it will also prevent edits on the subform. Setting Allow
Additions to No on the main form won't affect the subform.
 
Yes, it does update in both the table which updates the query, however,
instead of changing an existing value in the table, I'd like to add a new
record so that an audit log of every change can be maintained. Do I need an
add button instead? And, how do I not allow any changes (set the Allow Edits
to No)?

Thank you, Wayne.
 
I got it to update the table and add a new record! However, in my "add"
button, it takes me to the frm_qry_Contract_history which shows all
contracts. I only want to limit the view to the specific contract_no
selected on the Main form in order to add the new record to the subform.

Please advise how to limit the update to only a specific contract_no.

Thanks!
gg
 
AllowEdits is a property of the form. It is on the Data tab of the
Properties dialog. It can also be set through code:

Me.AllowEdits = False

If the query is updateable, then there should be a New Record line in the
form after the last existing record if you haven't set AllowAdditions to
No/False. You just need to go to that record. On the record selectors, it is
the right arrow with and *.
 
To limit the subform's records to those associated with the parent form's
records you need to set the Link Child Fields and Link Master Fields
properties of the subform control on the parent form. Open the parent form
in design mode, open the Properties dialog, and click on the subform ONE
time. This will give you the properties of the subform control that holds
the subform. The link fields are on the Data tab. Set both of them to the
appropriate field for the contract number on each form.
 
Back
Top