Why Oh Why Cant I Do 'If Dirty'

Jul 26, 2006

Please help,

I have more than one cancel button which is made visible depending on the previous form that has opened the current form.

ie. on Form1

FORMS!frmSub!cancelbuttonfrm1.visible=true

or Form 2

FORMS!FrmSub!cancelbuttonfrm2.visible=True

I want it to run an undo before closing, undo the previous form and close back to the mainmenu. However if the form isnt dirty (No changes have been made) then when the undo is called i get a run time error.

So why not do it as on dirty cancelbuttonfrm1.visible=true i hear you ask, well how can i make different buttons visible dependant on the previous form?

Obviously Access knows that the form is dirty because it triggers the undo or do you want to save.

So can i not just do 'IF Frmsub is dirty then undo else close form'

View Replies


ADVERTISEMENT

Me.Refresh And Me.Dirty

Jan 10, 2005

guys..idesperately need some helphere. i have a form,and when someone is scrolling through the records, if they make a change in it, and then when they try to move to another record, i would want to prompt them to save their changes. however, the me.dirty property seems to be working erratically. some changes cause it to be true, and some don't. i suspect this isbecause i use a me.refresh which causes the me.dirty to be false even when i make changes.
what can i do about this? if the user doesnt choose to save their changes, can the changes be undone aftera me.refresh?

View 1 Replies View Related

Date Format/Right/Year = Dirty

Apr 5, 2005

:confused: Want code to run when only year-part of date is dirty, but it's not working. Any idea?


Private Sub DateField_BeforeUpdate(Cancel As Integer)

If (right(Me. DateField, 4)) = Dirty Then (code runs at all changes)
‘If (Format(Me. DateField, "yyyy")) = Dirty Then (code runs at all changes)
‘If (year(Me.DateField)) = Dirty Then (code not running)


If DCount....
Me.IDnr = Nz(DMax....
End If
End If
End Sub

View 2 Replies View Related

Enable Main Frm Cmd Button When Subfrm Is Dirty

Sep 30, 2006

Hi,

Haven't used the 'ondirty' property before and am having trouble with it.

I have a main form (PersAction) with a subform (PersAction_PersData). After Insert button is click, subform appears ready for new data. click save works great. I wish to have an undo button on the main form become visible once data is entered into the subform. I've tried the following code in both the main form and subform 'Ondirty' property as an event and no luck:

If Me!PersAction_PersData.Dirty Then
Me!cmdUndo.Enabled = True ' Enable button.
Else
Me!cmdUndo.Enabled = False ' Disable button.
End If

Any help would be appreciated

thanks in advance

Hawg1

View 3 Replies View Related

Forms :: Close All Forms Except 1 But Not If Dirty

Jun 22, 2013

i am wanting to close all forms on timer event. all forms except one. also if any form is dirty then i do not want to even start running the vba.i have seen a thread that gives me the code to close all forms except listed but im not sure about getting access to look at all the forms first, see if any are dirty then exit sub

the main reason for this is my staff sometimes do not log out. and for audit trails this can be bad. who's done what when and where.the code for closing all forms

Code:
'This code closes all open forms in the current project and then opens the named form in quotations
Dim obj As Object
Dim strName As String
For Each obj In Application.CurrentProject.AllForms
Debug.Print obj.Name
If obj.Name = "StartFilter" Then

[code]....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved