A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Can't save record



 
 
Thread Tools Display Modes
  #1  
Old February 10th, 2010, 08:53 PM posted to microsoft.public.access.forms
BruceM via AccessMonster.com
external usenet poster
 
Posts: 448
Default Can't save record

I asked a question yesterday in the Forms Programming group, but have not
received a reply, so I am trying again with less detail and a different
subject line.

Is it possible to save a record that has no user-input values, but only
Default Values? The record in question is in the top level table. At first
it contains only a date. Later, when the subform records are processed,
there will be more data. However, as it stands subform records are orphans
because Access does not recognize a main form record, and therefore there are
no values in the linking field.

I could solve the problem by making the user input the date, or using a
command button to add the date, or some such, but since the date is almost
always today's date I would rather automate its entry.

I could use If Me.NewRecord to add the date, but if the user navigates to
another record without adding subform records there will still be a parent
record. I would probably have to run a Delete query of some sort to get rid
of the childless parent record.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201002/1

  #2  
Old February 10th, 2010, 09:53 PM posted to microsoft.public.access.forms
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Can't save record

Is it possible to save a record that has no user-input values, but only
Default Values?
Based on the information you supplied I say no unless you are using an
autonumber for primary key.

--
Build a little, test a little.


"BruceM via AccessMonster.com" wrote:

I asked a question yesterday in the Forms Programming group, but have not
received a reply, so I am trying again with less detail and a different
subject line.

Is it possible to save a record that has no user-input values, but only
Default Values? The record in question is in the top level table. At first
it contains only a date. Later, when the subform records are processed,
there will be more data. However, as it stands subform records are orphans
because Access does not recognize a main form record, and therefore there are
no values in the linking field.

I could solve the problem by making the user input the date, or using a
command button to add the date, or some such, but since the date is almost
always today's date I would rather automate its entry.

I could use If Me.NewRecord to add the date, but if the user navigates to
another record without adding subform records there will still be a parent
record. I would probably have to run a Delete query of some sort to get rid
of the childless parent record.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201002/1

.

  #3  
Old February 10th, 2010, 11:21 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Can't save record

On Wed, 10 Feb 2010 12:53:02 -0800, KARL DEWEY
wrote:

Is it possible to save a record that has no user-input values, but only

Default Values?
Based on the information you supplied I say no unless you are using an
autonumber for primary key.


Not even then, actually, since there's nothing to "dirty" the record.
--

John W. Vinson [MVP]
  #4  
Old February 10th, 2010, 11:24 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Can't save record

On Wed, 10 Feb 2010 19:53:45 GMT, "BruceM via AccessMonster.com" u54429@uwe
wrote:

I could use If Me.NewRecord to add the date, but if the user navigates to
another record without adding subform records there will still be a parent
record. I would probably have to run a Delete query of some sort to get rid
of the childless parent record.


That's sort of a "chicken or egg" problem: you can't have a child record
unless there is a parent record, and (by your rule) you can't have a parent
record unless there is a child record! At *some* point in the process one
record (the parent) must be created first.

It sounds like your parent table in the one-to-many relationship contains
nothing but a date. Is that the case? If so, what purpose does this table
serve? What Entities (real-life people, things, or events) are modeled by your
tables, and how are they related? Perhaps this table isn't needed at all; if
you just want to automatically enter today's date in what's now the child
table, could you instead simply use a date/time field defaulting to =Date() ?
--

John W. Vinson [MVP]
  #5  
Old February 11th, 2010, 01:44 PM posted to microsoft.public.access.forms
BruceM via AccessMonster.com
external usenet poster
 
Posts: 448
Default Can't save record

I had the details in the first posting, but simplified for this thread
because I had not received a reply. The situation is that documents are sent
around for review. Typically there are several at once (a batch, for lack of
a better term). The parent record contains fields for StartDate, EndDate,
and a Yes/No field that is a bit difficult to describe. In a sense each
document is being individually reviewed, but in practice related documents
are reviewed together. The Batch record does little more than provide a way
to group the records. I cannot use the StartDate as the grouping field, as
several batches may be sent to different sets of people on the same day.

The general structure is as follows:

tblBatch
BatchID (PK)
StartDate
EndDate
YesNoField

tblDocument
DocID (PK)
Doc_BatchID (linking field)
DocNumber
Description
etc.

tblReview
ReviewerID (PK)
R_BatchID (linking field)
EmployeeID (from Employee table)
ReviewDate

tblIndividualReview
IR_ID (PK)
IR_DocID (linking field)
IR_EmployeeID
IR_Date

tblEmployee
EmployeeID (PK)
FirstName
etc.

There may be ten documents in a batch, all of which are reviewed by the
employees listed in tblReview, but one of which is to be reviewed by another
employee. That is why there is tblIndividualReview. I could have handled
the two separate Review tables differently, perhaps by using Append SQL to
add the all-document reviewers at once to all of the IndividualReview records
(rather than having to fill in each IndividualReview record separately), but
that still leaves me with the Batch record and the DefaultValue problem.

I may have to require that the date be entered in tblBatch. There is another
possible option I can think of. The Yes/No field is Allen Browne's Yes/No
replacement field, which is a number field with a Default Value of 0. I can
omit the Default Value, and instead set the field to 0 in the Enter event of
the subform control for the subform bound to tblDocument, then save the
record. That seems to work, but I am afraid there may be difficulties I have
not yet discovered. In the end the best thing may be just to hide the
subform controls for a new record until the user enters a StartDate. Or
maybe I have overlooked something about how to structure the whole project.


John W. Vinson wrote:
I could use If Me.NewRecord to add the date, but if the user navigates to
another record without adding subform records there will still be a parent
record. I would probably have to run a Delete query of some sort to get rid
of the childless parent record.


That's sort of a "chicken or egg" problem: you can't have a child record
unless there is a parent record, and (by your rule) you can't have a parent
record unless there is a child record! At *some* point in the process one
record (the parent) must be created first.

It sounds like your parent table in the one-to-many relationship contains
nothing but a date. Is that the case? If so, what purpose does this table
serve? What Entities (real-life people, things, or events) are modeled by your
tables, and how are they related? Perhaps this table isn't needed at all; if
you just want to automatically enter today's date in what's now the child
table, could you instead simply use a date/time field defaulting to =Date() ?


--
Message posted via http://www.accessmonster.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:08 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.