subform questions here

V

Van T. Dinh

See comments in-line.

HTH
Van T. Dinh
MVP (Access)



-----Original Message-----
1. can my subform be invisible (visible set to no) and
make a command button that makes it visible?
Yes.

Me.SubformCONTROL.Visible = True

should do.


2. is there a way to turn off one-to-many so that the user
doesnot see that they can make another child....in fact
prohibit the user from making a second child?
It is possible to fudge...

However, the critical question is why do you set up a One-
to-Many relationship and use the Form / Subform
combination (which is designed especially for the One-to-
Many relationship) but you actually want (more or less) a
One-to-One relationship???


3. can I remove the record advance at the bottom of the
subform window?
Yes if you use a Form as the Subform (or more technically
accurate, if you use a Form as the SourceObject of the
Subform Control). You can simply set the "Navigation
Buttons" Property of this Form (the SourceObject) to False.


4. A record is not added to table2 (the source table for
the subform) unless the user clicks into the subform and
inputs data in atleast one child. Is there anyway to
force a child to be created with "null" or "default" data
even if the user doesnot go into the subform.
Yes (use the AfterUpdate Event of the main Form) but why?

Dummy Record doesn't have useful data and more often than
not create problems later. Dummy Records are never
necessary if you use Access correctly. I am yet to use
dummy Records in any database (and I have done quite a
few, some got more than 100 Tables).

It is probably related to the problem of using One-to-Many
relationship while you really want One-to-(at most)One
relationship.


5.Is the source object property the name of the subform or
is it the name of the underlying table........wizard made
it the name of my subform!
OK, it is related to Q3. The SourceObject Property is the
name of the Table in your case. You can only see the name
of the Subform*CONTROL* in the DesignView of the Main Form.

Note that you are using the DatasheetView of the Table and
NOT a Form as the SourceObject. In this case, you canNOT
turn off the Navigation Buttons of the Subform.


6. I have a command button on my main form called "main
menu" which has code under it saying "Docmd.Save"
should that not save to the underlying table the new
record just input, before going to the main menu form?
If it does not, could there possibly be a validation rule
breach and Access just closed the form without alerting
the user?
DoCmd.Save does NOT save the current Record. DoCmd.Save
saves the Design of the current data object, i.e. your
Form in this case. You actually need:

DoCmd.RunCommand acCmdSaveRecord

to save the Current Record on the Form.
 
M

mark R.

you said:
Note that you are using the DatasheetView of the Table
and NOT a Form as the SourceObject. In this case, you
canNOT turn off the Navigation Buttons of the Subform.

I understand. But I like the datasheetView "look" and it
works for me in my application very well. In fact, I went
back and thought again about how I can leave be the child
relationship and all your admonishines and I agreed and
found a way to use this child relationship and forget the
dummy records, etc.

So how do I create a form that looks like the Datasheet
version AND FUNCTIONS like a Datasheet in that a child
record row automatically is created when the user finishes
filling out the first record and advances to the next row.
Perhaps you might say it can't be done, but I could fudge
it by having a command button that is labeled "To Create
New record".....and then just arrange my text boxes in
datasheet appearance and use labels above each
column.....but Then you don't get all the records visible
at once, and get the vertical scrolling bar on the right
and on the bottom, etc.

Guide me, please.

PS, your answers to my last writing were amazingly
empathetic and helpful at the same time. I appreciated
you dealing with the way I was seeing the world and not
just brushing aside what I thought I wanted.
 

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