show a new (blank) record in form

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

Guest

Hi ya'll,

I have a form with a datasheet on it that contains a query - in the query
are two tables related by an itemno. One is the parts table, the other is a
table of history where people log out parts. My problem: I would like to
see a new history record to post the next logout to each time I pull up the
form but continue to see the related itemno/description that I currently
show. Should I unrelate the records (which of course has it's own
repercussions)? By the way it is set to Enforce Integrity, one to many.

You help is greatly appreciated.

Thanks.
 
Hi, Bonnie.

If you want to always add new records, set the form's DataEntry property to
Yes. To override the current settings of the AllowEdits, AllowDeletions,
AllowAdditions, and DataEntry properties, use the acFormAdd parameter with
the openform method:

DoCmd.OpenForm "YourForm", , , , acFormAdd

To open to a new record, but permit users to browse existing ones, use the
GoToRecord method in the On Open event:

DoCmd.GoToRecord , , acNewRec

Hope that helps.
Sprinks
 
My problem is that I want to see the existing inventory record but want a new
log out record and these two tables are related.

Thanks.
 
If the log out records are in a subform, follow the same strategy for it.
Set the subform's DataEntry property to Yes, or follow one of the other
methods.

Hope that helps.

Sprinks
 
The subform has a query that includes the inventory table and the log out
table (related on itemno). This is because the inventory table contains the
item description and quantity on hand that they can scroll through and pick
their items.

So the question is: can I have a related table show me existing inventory
items while giving me a new log out item at the same time. They are related
on itemno so I would expect an itemno to populate that field when I append
the new logout information.

Thanks for your help.
 
Bonnie,

My apologies; I don't think I understood you clearly the first time. I
think the problem lies in the design of your form. Since there is a natural
one-to-many relationship between Parts and Logouts, it would be better
implemented with a main form based on the Parts table, containing an embedded
subform based on Logouts, linked on the ItemNo, rather than using a query.

By "linked", I mean that the subform's MasterLinkFields and
MasterChildFields properties are set to the name of the linking field in the
Parts and Logouts tables, respectively.

On the main form, you can show the part number, the description, the
qtyonhand, etc. The subform needs only the fields you need to describe each
logout (date, qty, requistioner, etc.) but does NOT require the part number.
Access fills that into the Logout table automatically because you've set the
link.

As you scroll through the main form records, you will see only the logouts
associated with that part. If you wish to enter only new records in the
subform, set its DataEntry property to Yes.

Hope that helps.
Sprinks
 
Thanks Sprinks. I'm going to play with this suggestion and see what I can
do. The one gotcha is that the main form already had a table associated with
it (three tables related) - the requistions table. Perhaps I can use a query
with the Requisitons and Parts tables for the main form and the LogOut form
on the subform. My gears are grinding. If they come to a halt I'll be back.

Thanks again.
 
Brain fuzz - I'm having problem with this. Do you know if any of the samples
or templates has something like this in it that I might look at to get my
bearings. I can see putting one record on the master form and multiple
logouts on the subform but I can't figure out how to have a datasheet on the
master form and a datasheet on the subform that relates? What's wrong with
my thinking?
 
Bonnie,

Obviously the construction of your form and its underlying RecordSources is
more complex than I initially understood. To help you, I will need a clear
understanding of the table structures, their relationships, the queries
underlying the main and subforms, the relationship between the main and
subform, and generic descriptions of how the form and subform is or is to be
used.

One thing you may wish to consider is Divide and Conquer. If the current
form seems too complex or is trying to accomplish multiple tasks, you may
wish to break the logging function into a separate task on another, simpler
form, opened by a command button on the current one.

Sprinks
 
Back
Top