How do I get the sub form to display a blank record?

J

Joe

Hi All

I have a main form that uses a lookup combo box and then a sub form
that displays the associated Child record based on the selected lookup
value. When first opening the form I have set the code to make the
lookup display a value of blank. However, my sub form still displays
the first record in the associated table. Is there anyway to make the
subform display no record upon opening the form for the first time?

Thanks in advance!
 
J

Joe

Set the Data Entry mode to Add on the Data menu of the property sheet.

Thanks Arvin

I guess this may raise a larger question about whether my forms
structure is the right one to use. I want to have a form that allows
Edits & Additions in a graceful manner. I have a primary form with a
"project code" and many sub form records that reference that project
code. I find scrolling horizontally through sub form records
cumbersome but I have too many data fields to use a worksheet view.
Any ideas on how I can view my sun form records in an orderly easy to
view manner while providing users the ease of a form view for data
entry?

Thanks again!!
 
N

NG

Hi Joe,

if you're working with Access 200, you can create a split form: in one half
(upper or lower) you see an excerpt of the most important fields of the data
in datasheet view, in the lower half you have the detailed view of all fields
of 1 record. When you click a record in the dataview, the clicked record is
displayed in the detail section.
 
A

Arvin Meyer [MVP]

I guess this may raise a larger question about whether my forms
structure is the right one to use. I want to have a form that allows
Edits & Additions in a graceful manner. I have a primary form with a
"project code" and many sub form records that reference that project
code. I find scrolling horizontally through sub form records
cumbersome but I have too many data fields to use a worksheet view.
Any ideas on how I can view my sun form records in an orderly easy to
view manner while providing users the ease of a form view for data
entry?

You can always use the Double-click event to go to a new record:

Private Sub Form_DblClick(Cancel As Integer)
DoCmd.GoToRecord , , acNewRec
End Sub

I'd also filter the records so they don't have to scroll through unnecessary
ones.
 
D

David W. Fenton

m:
I guess this may raise a larger question about whether my forms
structure is the right one to use. I want to have a form that
allows Edits & Additions in a graceful manner.

I basically never allow editing or addition of new records in a
continuous or datasheet subform. Editing is accomplished through a
second subform bound to the PK of the currently selected record in
the subform. This also means that to add a record, you click and ADD
RECORD button that creates a stump record via SQL executed in DAO,
and then requeries the subform and selects that record (having
captured the PK value in the process of adding the record). For
deletes, I delete in SQL, then requery the subform.

The test I use to determine if the subform is going to be editable
and/or add records is if the any of the controls on the subform
display data that is conditional on the particular record being
displayed. This is particularly important for combo boxes that
display different data depending on some other data in the current
record. This can't be done properly in a continuous or datasheet
subform, and that's why I opt for displaying the detail record in a
different subform, where the conditional combo boxes are not a
problem.
 

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