logo

Form Coding Problem (ASP.NET)
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
February 0 $0.00 0
January 0 $0.00 0

Didn't Find The Answer You Were Looking For?

EggHeadCafe has experts online right now that may know the answer to your question.  We pay them a bonus for answering as many questions as they can.  So, why not help them and yourself by becoming a member (free) and ask them your question right now?
Ask Question In Live Forum

If you have an OpenID and do not want to become a member of the EggHeadCafe forum, you can also sign on to Chat Chaos and post your question to our real time Silverlight chat application.
Ask Question In Chat Chaos










  $1000 Contest    [)ia6l0 iii - $228  |  Jonathan VH - $161  |  Huggy Bear - $135  |  F Cali - $95  |  egg egg - $94  |  more Advertise  |  Privacy  |   (c) 2010