Problems with DataEntry = True

Hi

I am opening a form "Add New Job", which on load, sets its DataEntry
attribute to true. If I enter no details & close the form, a record
had been created, so I added code to delete the record if no details
had been entered. Now when I close the form without entering any
details, it deletes the current record it has just created, but
creates another one with the next sequence number.

What I want it to do is create no record if no details are added. How
can I achieve this?

Yours

Stapes

0
Stapes
8/22/2007 11:32:16 AM
access 16762 articles. 3 followers. Follow

6 Replies
1032 Views

Similar Articles

[PageSpeed] 7

Are you sure it's deleting the record you just created?

The DataEntry property does not determine whether or not records can be 
added: it only determines whether existing records are displayed. Try 
changing it to False, and see whether the record's still there.

To control whether or not entries may be added, you use the AllowAdditions 
property.

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Stapes" <steve.staple@gmail.com> wrote in message 
news:1187782336.815956.108750@q3g2000prf.googlegroups.com...
> Hi
>
> I am opening a form "Add New Job", which on load, sets its DataEntry
> attribute to true. If I enter no details & close the form, a record
> had been created, so I added code to delete the record if no details
> had been entered. Now when I close the form without entering any
> details, it deletes the current record it has just created, but
> creates another one with the next sequence number.
>
> What I want it to do is create no record if no details are added. How
> can I achieve this?
>
> Yours
>
> Stapes
> 


0
Douglas
8/22/2007 12:15:49 PM
On 22 Aug, 13:15, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
> Are you sure it's deleting the record you just created?
>
> The DataEntry property does not determine whether or not records can be
> added: it only determines whether existing records are displayed. Try
> changing it to False, and see whether the record's still there.
>
> To control whether or not entries may be added, you use the AllowAdditions
> property.
>
> --
> Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
> (no e-mails, please!)
>
> "Stapes" <steve.sta...@gmail.com> wrote in message
>
> news:1187782336.815956.108750@q3g2000prf.googlegroups.com...
>
>
>
> > Hi
>
> > I am opening a form "Add New Job", which on load, sets its DataEntry
> > attribute to true. If I enter no details & close the form, a record
> > had been created, so I added code to delete the record if no details
> > had been entered. Now when I close the form without entering any
> > details, it deletes the current record it has just created, but
> > creates another one with the next sequence number.
>
> > What I want it to do is create no record if no details are added. How
> > can I achieve this?
>
> > Yours
>
> > Stapes- Hide quoted text -
>
> - Show quoted text -

Hi

No - that's not what I want. I am setting it to data entry because I
ONLY want it to do additions, not display existing records.The Job
records are linked to a Boat record, the dtails of which are filled in
from the originating form. Options to View or Edit the Jobs record are
given elsewhere in the system.

Yours

Stapes

0
Stapes
8/22/2007 1:08:40 PM
"Stapes" <steve.staple@gmail.com> wrote in message 
news:1187788120.991643.117020@k79g2000hse.googlegroups.com...
> On 22 Aug, 13:15, "Douglas J. Steele"
>>
>> > I am opening a form "Add New Job", which on load, sets its DataEntry
>> > attribute to true. If I enter no details & close the form, a record
>> > had been created, so I added code to delete the record if no details
>> > had been entered. Now when I close the form without entering any
>> > details, it deletes the current record it has just created, but
>> > creates another one with the next sequence number.
>>
>> > What I want it to do is create no record if no details are added. How
>> > can I achieve this?
>>
>
> No - that's not what I want. I am setting it to data entry because I
> ONLY want it to do additions, not display existing records.The Job
> records are linked to a Boat record, the dtails of which are filled in
> from the originating form. Options to View or Edit the Jobs record are
> given elsewhere in the system.

I would assume that the record is being created when the form's opened 
because you have default values assigned for one or more of the fields. 
Assuming you're talking about an Autonumber when you say "the next sequence 
number", there's no way of reclaiming that value unless you prevent Access 
from creating the record first.

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



0
Douglas
8/22/2007 1:18:32 PM
On 22 Aug, 14:18, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
> "Stapes" <steve.sta...@gmail.com> wrote in message
>
> news:1187788120.991643.117020@k79g2000hse.googlegroups.com...
>
>
>
>
>
> > On 22 Aug, 13:15, "Douglas J. Steele"
>
> >> > I am opening a form "Add New Job", which on load, sets its DataEntry
> >> > attribute to true. If I enter no details & close the form, a record
> >> > had been created, so I added code to delete the record if no details
> >> > had been entered. Now when I close the form without entering any
> >> > details, it deletes the current record it has just created, but
> >> > creates another one with the next sequence number.
>
> >> > What I want it to do is create no record if no details are added. How
> >> > can I achieve this?
>
> > No - that's not what I want. I am setting it to data entry because I
> > ONLY want it to do additions, not display existing records.The Job
> > records are linked to a Boat record, the dtails of which are filled in
> > from the originating form. Options to View or Edit the Jobs record are
> > given elsewhere in the system.
>
> I would assume that the record is being created when the form's opened
> because you have default values assigned for one or more of the fields.
> Assuming you're talking about an Autonumber when you say "the next sequence
> number", there's no way of reclaiming that value unless you prevent Access
> from creating the record first.
>
> --
> Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
> (no e-mails, please!)- Hide quoted text -
>
> - Show quoted text -

Hi

I am not interested in reclaiming the Autonumber value - I mentioned
it because Access IS deleting my current record - as required - but
then creating a next one. I want it to delete the record if there were
no details added & close the form. Full stop. Not create an extra
record.

Stapes

0
Stapes
8/22/2007 1:29:43 PM
Access doesn't arbitrarily create records.  If you are getting records 
created when you don't want them to be it is because you have code in some 
form event that is dirtying the record and that is causing Access to think 
it needs to save it.

Your code should NEVER dirty a record.  That means that your code shouldn't 
run before the form's BeforeInsert event.  The BeforeInsert event runs as 
soon as the user types the first character in the form.  That way, the user 
can use the esc key to back out any changes he made or you can have code 
that uses the form's Undo method to back out changes.  You shouldn't have to 
resort to deleting records.

The first place to check is the AfterUpdate event.  Many people put code 
here not realizing that this event runs AFTER the record is updated and so 
if you dirty the record in this event, you are essentially causing an 
endless loop because Access will need to save the record again to update the 
info you just changed and that will cause the AfterUpdate event to run again 
and dirty the record... you see where this is going?  I believe that newer 
versions of Access detect this recursion and break out of the loop 
eventually but it could explain the creation of the extraneous records.

"Stapes" <steve.staple@gmail.com> wrote in message 
news:1187782336.815956.108750@q3g2000prf.googlegroups.com...
> Hi
>
> I am opening a form "Add New Job", which on load, sets its DataEntry
> attribute to true. If I enter no details & close the form, a record
> had been created, so I added code to delete the record if no details
> had been entered. Now when I close the form without entering any
> details, it deletes the current record it has just created, but
> creates another one with the next sequence number.
>
> What I want it to do is create no record if no details are added. How
> can I achieve this?
>
> Yours
>
> Stapes
> 


0
Pat
8/22/2007 2:38:23 PM
Stapes <steve.staple@gmail.com> wrote in
news:1187789383.141886.263130@g4g2000hsf.googlegroups.com: 

> On 22 Aug, 14:18, "Douglas J. Steele"
> <NOSPAM_djsteele@NOSPAM_canada.com> wrote:
>> "Stapes" <steve.sta...@gmail.com> wrote in message
>>
>> news:1187788120.991643.117020@k79g2000hse.googlegroups.com...
>>
>>
>>
>>
>>
>> > On 22 Aug, 13:15, "Douglas J. Steele"
>>
>> >> > I am opening a form "Add New Job", which on load, sets its
>> >> > DataEntry attribute to true. If I enter no details & close
>> >> > the form, a record had been created, so I added code to
>> >> > delete the record if no details had been entered. Now when I
>> >> > close the form without entering any details, it deletes the
>> >> > current record it has just created, but creates another one
>> >> > with the next sequence number. 
>>
>> >> > What I want it to do is create no record if no details are
>> >> > added. How can I achieve this?
>>
>> > No - that's not what I want. I am setting it to data entry
>> > because I ONLY want it to do additions, not display existing
>> > records.The Job records are linked to a Boat record, the dtails
>> > of which are filled in from the originating form. Options to
>> > View or Edit the Jobs record are given elsewhere in the system.
>>
>> I would assume that the record is being created when the form's
>> opened because you have default values assigned for one or more
>> of the fields. Assuming you're talking about an Autonumber when
>> you say "the next sequence number", there's no way of reclaiming
>> that value unless you prevent Access from creating the record
>> first. 
>>
>> --
>> Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
>> (no e-mails, please!)- Hide quoted text -
>>
>> - Show quoted text -
> 
> Hi
> 
> I am not interested in reclaiming the Autonumber value - I
> mentioned it because Access IS deleting my current record - as
> required - but then creating a next one. I want it to delete the
> record if there were no details added & close the form. Full stop.
> Not create an extra record.
> 
> Stapes
> 
No you do not want to delete the record, you want to prevent the 
record from being created in the first place. It's a subtle 
difference, but an important one.

Access will only create the record when you exit that record, either 
by closing the form or moving to another record, having 
added/changed data in any control bound to the form's record source, 
the table. 

What you need to do is to undo any changes made to the form before 
moving off that record, unless you have set a flag that the user has 
actually added something to one of the form's controls.  Me.Undo is 
all it takes. You just need to write some code that captures any 
changes that have been made by the user to prevent the me.undo.


 




-- 
Bob Quintal

PA is y I've altered my email address.

-- 
Posted via a free Usenet account from http://www.teranews.com

0
Bob
8/22/2007 9:16:53 PM
Reply:

Similar Artilces:

On-line Manual Problem
We are setting up money 2004for the first time, and can not get access to the on-line manual. I checked the browser security settings as suggested, and they are OK, but I just get an error message that the page can not be opened. Any suggestions as to what I am missing? Thanks SteveG In microsoft.public.money, steveg wrote: >We are setting up money 2004for the first time, and can >not get access to the on-line manual. I checked the >browser security settings as suggested, and they are OK, >but I just get an error message that the page can not be >opened. > >...

Public Folder Access Problem
When tryit to access the properties on an Exchange 2000 public folder, I receive the following error: The token supplied to the function is invalid. ID No 80090308 Exchange System Manager Has anyone seen this type of error before? ...

SetWorldTransform problem
I've created simple SDI project and when I put such stuff on OnPaint for the View class the GDI operations after SetWorldTransform doesn't seem to work. Why? I add that I'm working on default MM_TEXT mapping mode and XP system CPaintDC dc(this); HDC hDc = dc.GetSafeHdc(); XFORM xTransform; CRect area(100,100,200,200); dc.Rectangle(area); // this one is visible int oldMode = SetGraphicsMode(hDc, GM_ADVANCED); xTransform.eDx = 200; xTransform.eDy = 100; SetWorldTransform(hDc,&xTransform); dc.Rectangle(area); // this one was not painted !!?? xTransform.eDx = xTransform.eDy = 0;...

CComboBox problem
Hi, I need to make CComboBox edit control stretchable with the mouse, something like in IE address box, that user can drag the right corner e.g. more to the right. Is it hard to do? thanks It's not hard. You can change the size (width only) of a combo box by calling SetWindowPos() or MoveWindow(). The harder part is intercepting the events that indicate the window must be resized and handling all that correctly. -- Jonathan Wood SoftCircuits Programming http://www.softcircuits.com "azuro" <ad@yahoo.com> wrote in message news:O8tHe$atGHA.1888@TK2MSFTNGP03.phx.gb...

Communication problem on remote administration
I have a network with 2 exchange 5.5 servers on NT4 Servers. From a remote PC using Exchange administrator i an connect to one server but the other i keep getting an error saying Exchange server computer doesnot repsond Microsoft Exchange Directory ID No DS_E_Communications_Problems All servers have latest service packs as does the remote administration machine. If you are on the console of the other Exchange 5.5 server can you access Exchange Administrator? amyma@online.microsoft.com Please do not send email directly to this alias. This alias is for newsgroup purposes only. This posti...

Problem logging into account after account had been disabled.
Hello, I had a user disabled and moved to a OU that I just use to store the disabled accounts. I re-enabled the account and moved back to the Users OU. Now when the user tries to access OWA they cannot login. BTW the server is Windows 2000 and the exchange is Exchange 2000 enterprise. When I browse to the m:\ drive on the server and attempt to open the users MBX folder I get "the folder has been moved or removed" while other users folders I just get a "Access denied" error. The event log has two errors everytime the user attempts to login. See below. Thanks, Chris DeF...

KDC error 11 : SPN problem
Hi, I've just successfuly installed MSCRM 1.2 in my domain. I have two servers, the both with Windows 2003 : -the first is the DC, with Exchange 2003, and CRM Router (name : anderson) -the second is a dedicated server to the CRM : it just have SQL Server 2000 and CRM 1.2 installed. SQL Server is just for the CRM (name : dozer). All the specific services for CRM, on the both server, are launched with a dedicated domaine user : CRMUser. This user have no specific right. The installation is successfull : my CRM works fine. The local url to access to the CRM is http://mscrm. Just have...

Excel 2007 "update file" problem
Hi, Excel file which is opened Read-Only can not be updated by "update file" button in Excel 2007, but in excel 2003 read-only excel files can be updated by update file button. when i share workbook, excel 2007 can update file by "update file" but i do not want this, other users must run as read-only. is this problem or by-design issue? thnx. ...

Problem to uninstall a driver.
Hi all ¡¡¡ i have installed video driver using the .inf files... Now i want to completelly uninstall this driver but in control panel i haven't uninstaller... If i try to uninstall the drivers with the device manager i can't.(i talks about the driver its necesarry to can boot the computer). Using f8 i have the same problem. Can anyone help me to uninstall these drivers ? Thanks all. "Sable" <Sable@discussions.microsoft.com> wrote in message news:8479179E-1B10-4D4E-AD60-8AC0E7470509@microsoft.com... > i have installed video...

domain email problem
hi i was wondering if anyone can help me with a problem i have. i have a domain name i use for my emails with jimmy in front of it but no matter what i change jimmy to i still recieve it. the problem is i want to create an account for my son which will be colin in front of the address but how can i make sure his emails go to his account and not mine. thanks in advance jimmy -- joneill60 Ask your domain host how to set up additional mailboxes at domain level. = This is not an Outlook problem. --=81 Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion inta...

Problem with Dates in Query
I have a field with dates. However, I need to separate only the year in another column. This is what I have so far but it is not working. Year: IIF([mydatefield] = #m/d/2009#,#2009#,IIf([mydatefield]=#m/d/2010#,#2010#)). Can somone please help me with this? Thank you. TotallyConfused wrote: >I have a field with dates. However, I need to separate only the year in >another column. This is what I have so far but it is not working. Year: >IIF([mydatefield] = #m/d/2009#,#2009#,IIf([mydatefield]=#m/d/2010#,#2010#)). How about: MyYearField: Year(mydatefield) ...

Network problem
My LAN (Workgroup) has been Working OK for years Now when trying to access the Network through Windows Explorer I get : "Not accessible, you might not have permission to use the network resource" "Not enough server storage to process this request" (This message pops up on any PC/Laptop that I try to access the workgroup from) The "network locations" column shows my PC as "LAN, but the others as "Internet" The only thing I can think may have stuffed things was an attempt to access a mobile phone using Bluetooth that I abandoned when...

Persistent Problem with USPS Shipping Assistant
When I try to launch the United States Postal Shipping Assistant I get: "the type initializer for microsoft.practices.enterpriselibrary.exceptionhandling.exceptionpolicy threw an exception." and it does not launch. I have uninstalled .Net Framework and reinstalled it, and this is the error I get. I've also tried reinstalling Shipping Assistant. When I google the error, it's mostly from programmers who are discussing code, not for end users of others applications. No other applications give me this error. Anyone have any advice on this one? -- Rober...

Salesperson ID Problem in SOP (Bug #45783)
Would any MS people be able to provide an update to the bug referenced in the subject line. Last indication was it was scheduled for SP3, but the problem still exists. -- Dave Stonesifer Dave: I actually checked on that a little while ago and I was told it was scheduled for 11.x RTM and was not going to be in a 10 SP. Things could have changed but that was the last bit of information I was given on this problem report. Hope that helps, JG "Dave" wrote: > Would any MS people be able to provide an update to the bug referenced in the > subject line. Last indicat...

Problems with Clustering
I've posted twice to the server clustering group, but my post hasn't shown either time, and things are critical. We had a SAN that went belly up over the weekend, and we're having problems getting the cluster back on line. It has been running for some time. There are 3 errors in the event viewer: Event ID: 1205; The Cluster service failed to bring clustered service or application 'printserver' completely online or offline. One or more resources may be in a failed state. This may impact the availability of the clustered service or application. ========...

Wierd problem
I am receiving some e-mails that are just blank in the message body. When I go to my webmail I can view the message but for some reason the message content is not downloading to Outlook. This is only for a few message and I cannot tell if there is a common thing with the e-mails that are not coming through. Also when I send a message from my Outlook to my office the message shows sent but it is not received at the office. I check the webmail for the office but it is not there. I can forward an e-mail from home and it arrives at the office but not an original message. I thought ...

Outlook Connector config problem
I could not locate a suitable thread for this issue hence starting a new one. I installed OlC 12.0.6423.1000 earlier last month. It downloaded all the mails from my Hotmail Live Inbox at that time and also downloaded mails from other Hotmail folders. My hard drive crashed and I resurfaced with all necessary software including OlC. Now I see that the mails that were downloaded in folders other than inbox are no longer downloaded. Only later mails from the date of reinstall are seen downloaded. How can I download the previous mails from all folders? Please suggest possible tips. ...

mail delivery problems #2
Hi, Our email system has been working fine for about 12 months but now for what seems like no apparent reason we are having problems. The setup is exchange 2003. The problem is that mail has stopped flowing from certain BE servers to a FE\bridgehead server. Some BE servers are in different routing groups and one BE server is inside the same routing group as the FE server. There is nothing sitting between the servers other than routers. Mail sent to the Internet from a BE server in the same RG as the FE server stays in the Internet SMTP queue on the BE server. Until recently, these em...

Named Pipe Security Problem,...
Hi, maybe this does not fit into this user group, but i dont know where to ask. Well i've written a windows service that runs with System account and creates a Named Pipe. The Pipe is created with lpSecurityAttributes = NULL. The Service starts successfully and i can control it with standard commands and my user defined ones. Now i wrote a C#.NET Frontend from where i want to send a byte stream to the Pipe created inside the service, but i always get a GetLastError=5 whenever i try to send my bytes from my client app. I know that i have to set the lanmanserver's registry key (paramete...

XL2000 "Custon Views" "Column width" Problem
Although the help file states that custom views will change colum widths, it does not. I have seen a few postings stating the sam problem but no solutions. Does anyone know if there is a fix for this? If not, is it possible to use Autofit just for a range in a column not for the whole column? De -- De ----------------------------------------------------------------------- Des's Profile: http://www.msusenet.com/member.php?userid=69 View this thread: http://www.msusenet.com/t-187096409 Instead of using custom views, could you just record some macros that set the columnwidths the way yo...

persmissions problem
This about the third time I've posted this issue. Here it is. Installed Exchange 2003 on network and using outlook 2002 which is not an issue. When regular users put the exchange server name and their name in outlook it won't resolve. Three boxes popup and ask for username, servername and domain which shouldn't happen. After putting that info a message comes back and says "your credentials are incorrect. If I use my admin account there is not problem. Outlook will only resolve admin accounts. Could someone please help. "coy" <anonymous@discussions....

[ANNOUNCE] Google Problem
It appears that for some unknown reason, it is now impossible to post from Google to many of the Microsoft newsgroups. If you try, you get a variation on this: "Google Groups does not currently support posting to microsoft.public.mac.office.word". We have no idea why this is happening (nor does Microsoft) but perhaps we can get it fixed if we all post to <groups-support@google.com> and ask for an explanation and a resolution. Even if you don't access the newsgroups via Google, you could help those users who do � and there are many � by posting such a message. Thanks to...

TRANSACTION PROBLEM, Pls Help me!
I have fallen into TRANSACTION problem in MSSQL2005. I created small easy to understand sample which throws same error as in my problem. So sample is : ============================================== CREATE PROCEDURE dbo.spTempProc2 AS BEGIN TRANSACTION CREATE TABLE #aa (col INT) ROLLBACK RAISERROR ('error test', 16, 1) GO =========================================== CREATE PROCEDURE dbo.spTempProc1 AS BEGIN TRANSACTION CREATE TABLE #aa (col INT) INSERT INTO #aa SELECT 1 EXEC dbo.spTempProc2 IF @@ERROR <> 0 RETURN COMMIT TRANSACTION GO ==============...

Big Problem
I have purchaged money 2006 2 month ago. Today I have formatted my computer for an upgradation. I need to install money again. How can I install this. I dont have the backup file. Can anyone tell me where to download the installer. I have .net passport that i used to purchage the money software. Thanks Start by downloading and installing the trial version from http://www.microsoft.com/money. Then login to a data file using the Passport you used to purchase the 2006. You can even put the Passport on the sample file. Word to the wise: Next time go to the store and buy the CD like regular f...

Outlook Archiving problem
Just a quick one, When I try to archive my emails whether be by autoarchive or manual, it wont move my old emails to my archive.pst. I have custom folders and it creates the folders in the archive.pst, but none of the old emails are moved across. When manual doing a manual archive, I select "include folders with do not archive", but still nothing. When autoarchiving, I make sure all folders are set to archive usiing the default settings and again nothing. Any ideas? I am currently using the outlook that comes with officeXP professional. Folders are created, but no emails a...