Search EggHeadCafe's Job Board
EggHeadCafe Silverlight WPF ASP.NET VB.NET C# Excel SQL Server SharePoint
search
MicrosoftArticlesForumsFAQs
C# .NET
VB.NET
Visual Studio .NET
ADO.NET
Xml / Xslt
VB 6.0
.NET CF
GDI+
LINQ
Deployment
Security
FoxPro
Silverlight / WPF
Entity Framework
RIA Services

WebArticlesForumsFAQs
JavaScript
ASP
ASP.NET
WCF

DatabasesArticlesForumsFAQs
SQL Server
Access
Oracle
MySQL
Other Databases

OfficeArticlesForumsFAQs
Excel
Word
Powerpoint
Outlook
Publisher
Money

Non-MicrosoftArticlesForumsFAQs
NHibernate
Perl
PHP
Ruby
Java
Linux / Unix
Apple
Open Source

Operating SysArticlesForumsFAQs
Windows 7
Windows Server
Windows Vista
Windows XP
Windows Update
MAC
Linux / UNIX

Server PlatformsArticlesForumsFAQs
BizTalk
Site Server
Exhange Server
IIS

Graphic DesignArticlesForumsFAQs
Macromedia Flash
Adobe PhotoShop
Expression Blend
Expression Design
Expression Web

OtherArticlesForumsFAQs
Lounge
Subversion / CVS
Ask Dr. Dotnetsky
Active Directory
Networking
Uninstall Virus
Job Openings
Product Reviews
Search Engines
Resumes

 

  View Other ASP.NET Posts   Ask New Question  Ask New Question With Power Editor

Form Coding Problem
Adam Evison posted at Tuesday, May 26, 2009 4:58 AM

Hi, not sure if this is the right group for this problem but here goes.

I am really really new to coding in access so youll have to bear with me.

I am trying to create a form in access which has a close button which closes the form. I have tried to design the form as data entry only, so all record navigation has been removed from the form and it is set to add new record on open. This is all fine.

I need to make it so that when the form is closed, the form cancels and deletes any record currently being edited in the current run through. The whole idea is that there will be a sequence of forms which open for the user to input data relating to the same item across multiple forms. Also the user must not be able to change anything already submitted.

I also need a dialog box to appear to warn the user about loss of progress with the data entry when the form is attempting to close.

Here's what I have so far on close:

Private Sub Form_Close()

If Me.Dirty Then GoTo DIALOG:

GoTo CLOSEFORMNOSAVE:

DIALOG:

MsgBox "Exiting the Add Car system now will delete any progress made. Are you sure you want to exit?", vbYesNo

If vbYes Then
GoTo CLOSEFORM:
ElseIf vbNo Then
GoTo CANCELCLOSE:
End If

CLOSEFORM:

DoCmd.RunCommand acCmdDeleteRecord
DoCmd.Close acForm, "Add Cars", acSaveNo
Exit Sub

CANCELCLOSE:

Exit Sub

CLOSEFORMNOSAVE:

End Sub

I know that this is probably full of bugs and errors. Essentially the form just closes and saves any data entered so far. Please could someone help me with this, I have been tearing my hair out. I am very limited with what I know, only what I've picked up from forums and help files. I would like to keep the commands and structure similar if I can, otherwise I will just get lost. :).

Any help would be greatly appreciated.

Thanks,

Adam

Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0