A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Change VB Code to Close



 
 
Thread Tools Display Modes
  #11  
Old June 4th, 2006, 11:21 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Change VB Code to Close - test dirty, undo

Hi Bob,

try this:

'~~~~~~~~~~~~~~~~~
Private Sub cmdClose_Click()

If IsNull(Me.subHorseDetailsChild.Form.OwnerID) Then

'if you want to undo the sub form
If Me.subHorseDetailsChild.Form.Dirty Then
Me.subHorseDetailsChild.Form.Undo
End If

'if you want to undo the main form
if me.dirty then
me.undo
endif

End If

DoCmd.Close acForm, Me.Name, acSaveNo

end sub
'~~~~~~~~~~~~~~~~~

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:
Sorry Crystal, I mean the from wont close!....Bob

"Bob" wrote in message ...

Crystal can it be change so if there is nothing in OwnerID it will not
close! Regards Bob


"Bob" wrote in message ...

Thanks Crystal for your help, Got it

Private Sub cmdClose_Click()
If IsNull(Me.subHorseDetailsChild.Form.OwnerID) Then
If Me.Dirty Then
Me.Undo
End If
End If

DoCmd.Close acForm, Me.Name

End





  #12  
Old June 5th, 2006, 02:58 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Change VB Code to Close - test dirty, undo

Thanks Crystal
I deletes the record ID if there is OwnerID is empty
But is it possible that nothing happens when you click Close_Click()
if OwnerID has no data Just saves re-entering data because you forgot to put
the OwnerID in
Thanks for your Help...........Bob


"strive4peace" "strive4peace2006 at yahoo dot com" wrote in message
...
Hi Bob,

try this:

'~~~~~~~~~~~~~~~~~
Private Sub cmdClose_Click()

If IsNull(Me.subHorseDetailsChild.Form.OwnerID) Then

'if you want to undo the sub form
If Me.subHorseDetailsChild.Form.Dirty Then
Me.subHorseDetailsChild.Form.Undo
End If

'if you want to undo the main form
if me.dirty then
me.undo
endif

End If

DoCmd.Close acForm, Me.Name, acSaveNo

end sub
'~~~~~~~~~~~~~~~~~

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:
Sorry Crystal, I mean the from wont close!....Bob

"Bob" wrote in message ...

Crystal can it be change so if there is nothing in OwnerID it will not
close! Regards Bob


"Bob" wrote in message ...

Thanks Crystal for your help, Got it

Private Sub cmdClose_Click()
If IsNull(Me.subHorseDetailsChild.Form.OwnerID) Then
If Me.Dirty Then
Me.Undo
End If
End If

DoCmd.Close acForm, Me.Name

End





  #13  
Old June 5th, 2006, 04:43 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Change VB Code to Close - test dirty, undo

you're welcome, Bob ... so did you have another question?

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:
Thanks Crystal
I deletes the record ID if there is OwnerID is empty
But is it possible that nothing happens when you click Close_Click()
if OwnerID has no data Just saves re-entering data because you forgot to put
the OwnerID in
Thanks for your Help...........Bob


"strive4peace" "strive4peace2006 at yahoo dot com" wrote in message
...

Hi Bob,

try this:

'~~~~~~~~~~~~~~~~~
Private Sub cmdClose_Click()

If IsNull(Me.subHorseDetailsChild.Form.OwnerID) Then

'if you want to undo the sub form
If Me.subHorseDetailsChild.Form.Dirty Then
Me.subHorseDetailsChild.Form.Undo
End If

'if you want to undo the main form
if me.dirty then
me.undo
endif

End If

DoCmd.Close acForm, Me.Name, acSaveNo

end sub
'~~~~~~~~~~~~~~~~~

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:

Sorry Crystal, I mean the from wont close!....Bob

"Bob" wrote in message ...


Crystal can it be change so if there is nothing in OwnerID it will not
close! Regards Bob


"Bob" wrote in message ...


Thanks Crystal for your help, Got it

Private Sub cmdClose_Click()
If IsNull(Me.subHorseDetailsChild.Form.OwnerID) Then
If Me.Dirty Then
Me.Undo
End If
End If

DoCmd.Close acForm, Me.Name

End




  #14  
Old June 5th, 2006, 04:53 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Change VB Code to Close - test dirty, undo

Is it Possible the Close_Click Button will not work unless OwnerId has Data
in it?
Seems a shame you enter data in other fields and forget to put it in OwnerID
then you lose it and have to re type again
Thanks Crystal

"strive4peace" "strive4peace2006 at yahoo dot com" wrote in message
...
you're welcome, Bob ... so did you have another question?

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:
Thanks Crystal
I deletes the record ID if there is OwnerID is empty
But is it possible that nothing happens when you click Close_Click()
if OwnerID has no data Just saves re-entering data because you forgot to
put the OwnerID in
Thanks for your Help...........Bob


"strive4peace" "strive4peace2006 at yahoo dot com" wrote in message
...

Hi Bob,

try this:

'~~~~~~~~~~~~~~~~~
Private Sub cmdClose_Click()

If IsNull(Me.subHorseDetailsChild.Form.OwnerID) Then

'if you want to undo the sub form
If Me.subHorseDetailsChild.Form.Dirty Then
Me.subHorseDetailsChild.Form.Undo
End If

'if you want to undo the main form
if me.dirty then
me.undo
endif

End If

DoCmd.Close acForm, Me.Name, acSaveNo

end sub
'~~~~~~~~~~~~~~~~~

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:

Sorry Crystal, I mean the from wont close!....Bob

"Bob" wrote in message ...


Crystal can it be change so if there is nothing in OwnerID it will not
close! Regards Bob


"Bob" wrote in message ...


Thanks Crystal for your help, Got it

Private Sub cmdClose_Click()
If IsNull(Me.subHorseDetailsChild.Form.OwnerID) Then
If Me.Dirty Then
Me.Undo
End If
End If

DoCmd.Close acForm, Me.Name

End






  #15  
Old June 5th, 2006, 05:26 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Change VB Code to Close - test dirty, undo

Hi bob,

Sounds like what you need is to use the BeforeUpdate
event... this is where data validation is done -- on the
subform BeforeUpdate event -- where the control is...

'~~~~~~~~~~~~~~~~~~ form BeforeUpdate
if isnull(me.ownerID) then
msgbox "You must enter OwnerID" _
,,"Missing Data"
CANCEL = true
end if
'~~~~~~~~~~~~~~~~~~

Undo will, of course, undo all the changes and that is not
what it appears you want to do

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:
Is it Possible the Close_Click Button will not work unless OwnerId has Data
in it?
Seems a shame you enter data in other fields and forget to put it in OwnerID
then you lose it and have to re type again
Thanks Crystal

"strive4peace" "strive4peace2006 at yahoo dot com" wrote in message
...

you're welcome, Bob ... so did you have another question?

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:

Thanks Crystal
I deletes the record ID if there is OwnerID is empty
But is it possible that nothing happens when you click Close_Click()
if OwnerID has no data Just saves re-entering data because you forgot to
put the OwnerID in
Thanks for your Help...........Bob


"strive4peace" "strive4peace2006 at yahoo dot com" wrote in message
...


Hi Bob,

try this:

'~~~~~~~~~~~~~~~~~
Private Sub cmdClose_Click()

If IsNull(Me.subHorseDetailsChild.Form.OwnerID) Then

'if you want to undo the sub form
If Me.subHorseDetailsChild.Form.Dirty Then
Me.subHorseDetailsChild.Form.Undo
End If

'if you want to undo the main form
if me.dirty then
me.undo
endif

End If

DoCmd.Close acForm, Me.Name, acSaveNo

end sub
'~~~~~~~~~~~~~~~~~

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:


Sorry Crystal, I mean the from wont close!....Bob

"Bob" wrote in message ...



Crystal can it be change so if there is nothing in OwnerID it will not
close! Regards Bob


"Bob" wrote in message ...



Thanks Crystal for your help, Got it

Private Sub cmdClose_Click()
If IsNull(Me.subHorseDetailsChild.Form.OwnerID) Then
If Me.Dirty Then
Me.Undo
End If
End If

DoCmd.Close acForm, Me.Name

End





  #16  
Old June 5th, 2006, 11:51 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Change VB Code to Close - test dirty, undo

you're welcome, Bob happy to help

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:
Thanks Crystal
Couldn't get that last code to work I will just stick with the deleting
code........Thank you very much for your help....Bob


"strive4peace" "strive4peace2006 at yahoo dot com" wrote in message
...

Hi bob,

Sounds like what you need is to use the BeforeUpdate event... this is
where data validation is done -- on the subform BeforeUpdate event --
where the control is...

'~~~~~~~~~~~~~~~~~~ form BeforeUpdate
if isnull(me.ownerID) then
msgbox "You must enter OwnerID" _
,,"Missing Data"
CANCEL = true
end if
'~~~~~~~~~~~~~~~~~~

Undo will, of course, undo all the changes and that is not what it appears
you want to do

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:

Is it Possible the Close_Click Button will not work unless OwnerId has
Data in it?
Seems a shame you enter data in other fields and forget to put it in
OwnerID then you lose it and have to re type again
Thanks Crystal

"strive4peace" "strive4peace2006 at yahoo dot com" wrote in message
...


you're welcome, Bob ... so did you have another question?

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:


Thanks Crystal
I deletes the record ID if there is OwnerID is empty
But is it possible that nothing happens when you click Close_Click()
if OwnerID has no data Just saves re-entering data because you forgot to
put the OwnerID in
Thanks for your Help...........Bob


"strive4peace" "strive4peace2006 at yahoo dot com" wrote in message
. ..



Hi Bob,

try this:

'~~~~~~~~~~~~~~~~~
Private Sub cmdClose_Click()

If IsNull(Me.subHorseDetailsChild.Form.OwnerID) Then

'if you want to undo the sub form
If Me.subHorseDetailsChild.Form.Dirty Then
Me.subHorseDetailsChild.Form.Undo
End If

'if you want to undo the main form
if me.dirty then
me.undo
endif

End If

DoCmd.Close acForm, Me.Name, acSaveNo

end sub
'~~~~~~~~~~~~~~~~~

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:



Sorry Crystal, I mean the from wont close!....Bob

"Bob" wrote in message
...




Crystal can it be change so if there is nothing in OwnerID it will
not close! Regards Bob


"Bob" wrote in message
...




Thanks Crystal for your help, Got it

Private Sub cmdClose_Click()
If IsNull(Me.subHorseDetailsChild.Form.OwnerID) Then
If Me.Dirty Then
Me.Undo
End If
End If

DoCmd.Close acForm, Me.Name

End




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I can receive email but cannot send it. pegasus General Discussion 175 April 27th, 2010 05:49 PM
Find the cell value in excel by using vb code Michael General Discussion 5 June 14th, 2005 01:24 PM
0x80040109 error when sending from SSL SMTP krouse General Discussion 7 March 15th, 2005 01:55 AM
My switchboards won't work with WinXP ! Jeff Conrad Using Forms 4 February 25th, 2005 08:51 PM
SMTP Authentication fails SharpEye General Discussion 0 February 25th, 2005 08:49 AM


All times are GMT +1. The time now is 07:28 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.