New row opens in datasheet subform

R

Robert

I have a datasheet subform with 3 columns. One of the columns has a default
value. When I open the main form and go to make an entry of a new record in
the datasheet subform a new line opens below the line I'm typing in and the
default value for the default-value column fills in in this line instead of
on the line typing in. So I have my entries split between 2 lines. Why
does this new line open and how can I prevent it?

Robert
 
J

Jeanette Cunningham

Hi Rober,
this is normal behaviour for Access.
As soon as you begin typing your entry in the datasheet, access shows you
the empty line for the following record.
Your entry isn't split at all, just continue putting your entry on the same
row (line) you started on and try to ignore the new empty line underneath.

I have never found any way to prevent the new line from showing up.

Jeanette Cunningham
 
R

Robert

On my screen the line below in not empty. The default value appears there
and my entry indeed is split. The resulting entry in the table has no value
where the default should be.

I'm going to change it to a continuous form.
 
J

Jeanette Cunningham

Robert, the default value should also be there in the record you just added.
I would expect the continuous form to do the same as the datasheet form.
How are you setting the default value?
in the table in the default value for that particular field?
in the form on the property sheet on the data tab in the default value for
that particular control ?
in code?

Jeanette Cunningham
 
R

Robert

You are right. The default refers to a field on the main form. When I
change it to refer to a form that is already open it works fine. Apparently
it can't evaluate this field in time for the subform entry. This is for a
series of several forms which are for renting vehicles. I should have
thought of that earlier. Thanks.
 
J

John W. Vinson

You are right. The default refers to a field on the main form. When I
change it to refer to a form that is already open it works fine. Apparently
it can't evaluate this field in time for the subform entry.

The subform (and its DefaultValue attributes) in fact is opened before the
mainform opens.

If you want a subform to inherit a value from the mainform (and don't want it
editable) you can make that field part of the Master/Child Field pair.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top