.DataEntry

Pauldohert

Something in here
Local time
Today, 07:46
Joined
Apr 6, 2004
Messages
2,101
Does using .Dataentry with .allowedits on a form still provide the benefits of .dataentry ie access does not return record(s) to populate the form?


Thanks
 
The DataEntry property limits the form to new records. The new records stay in the form's recordset until you close the form and they can be changed if you scroll back to them. So, if you open the form and add 10 records, those 10 records will be available until you close the form. The next time you open it, its recordset will be empty.

If you set the DataEntry property to yes and leave the other "allow" properties at yes, You can change and delete any record in the recordset of "new" records. But once you close the form, the recordset is empty until you add more new records. If you change the other "allow" properties to no, you can add new records and scroll back and forth in the recordset but you can't change or delete any of the new records.
 
Thanks Pat -

I open my form two ways - to edit a record and to add a record

to edit - I just allowedits

to add - I need allowadditions (plus dataentry)

if however I need to populate a field with code - i have to set .allowedits true also.

(this seemed odd to me as I do not need to set .allowedits to populate the fields manually)

Thankyou!
 
The .dataEntry setting is used to open the form to a new record and to limit the recordset to only those records added since the form was opened. If you need to edit or delete also, you would need to have those properties set to yes. I don't know what would happen if you had .dataentry set to yes and allowadditions set to no. I'm guessing the form would open with no controls showing.

if however I need to populate a field with code - i have to set .allowedits true also.
- there were probably different programmers involved in the development and one followed the specs and the other didn't :confused: Is setting allowedits to yes a problem for you?
 
Thanks Pat -

I was just wondering why - I needed the .allowedits to yes when what I am really doing is adding a record.

.dataentry set to yes and allowadditions set to no. I'm guessing the form would open with no controls showing.
True

Thanks again
 
You don't! You only need .allowedits to be yes if you want to edit records after you add them. The property works exactly the way I explained it earlier.
 
Thats what I assumed - which is why I asked the question - but it won't work unless I also add .allowedits (for populating a text box using code on the open event) ???

Thanks Paul
 
.DataEntry = True
.AllowAdditions = True
.AllowEdits = True
!kReferralID = gLong

This is basically all I am doing in the open event - to add a new record - it won't work unless I also allow edits.

The reasons probably obvious - it usually is - but I can't see it!



Paul
 
Last edited:
In what event is your code that modifies the record?
 
The Open event is not an appropriate event in which to place update code. The Open event only fires once and you may add multiple records before closing and reopening the form. So, your "update" would only be applied to the first record entered with this form. Also, the recordset isn't loaded until the Load event so there isn't anything there to update yet.

A better choice would be the BeforeInsert event. This event fires once for each new record immediately after the first character is typed in any field.
 
Thanks Pat - I will move it my code to a differant event. :-)
 

Users who are viewing this thread

Back
Top Bottom