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
  #1  
Old June 4th, 2006, 01:04 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Change VB Code to Close



I want to change this code slightly so if there is no data in The combo Box
OwnerInfo that the form will not save on closing
Private Sub cmdClose_Click()
If Me.OpenArgs = "ActiveHorses" Then
Me.Requery
Forms!frmActiveHorses.Visible = True
Forms!frmActiveHorses!cbHorseName.Requery
End If
subSetValues
DoCmd.Close acForm, Me.Name
End Sub

Thanks in advance.........Bob Vance


  #2  
Old June 4th, 2006, 05:44 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Change VB Code to Close

if what you said is what you meant -- the FORM will not save...
'~~~~~~~~~~~~~~~~`
if isnull(me.OwnerInfo) then
DoCmd.Close acForm, Me.Name, acSaveNo
else
DoCmd.Close acForm, Me.Name, acSaveYes
end if
'~~~~~~~~~~~~~~~

if what you meant is that the RECORD will not save...
'~~~~~~~~~~~~~~~~`
if isnull(me.OwnerInfo) then
if me.dirty then
me.undo
end if
end if

DoCmd.Close acForm, Me.Name
'~~~~~~~~~~~~~~~

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:
I want to change this code slightly so if there is no data in The combo Box
OwnerInfo that the form will not save on closing
Private Sub cmdClose_Click()
If Me.OpenArgs = "ActiveHorses" Then
Me.Requery
Forms!frmActiveHorses.Visible = True
Forms!frmActiveHorses!cbHorseName.Requery
End If
subSetValues
DoCmd.Close acForm, Me.Name
End Sub

Thanks in advance.........Bob Vance


  #3  
Old June 4th, 2006, 06:27 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Change VB Code to Close

Keep getting a compile error after Me.
The combo box is in SubHorseDetails on the form does that make a
difference....Thanx Bob
"strive4peace" "strive4peace2006 at yahoo dot com" wrote in message
...
if what you said is what you meant -- the FORM will not save...
'~~~~~~~~~~~~~~~~`
if isnull(me.OwnerInfo) then
DoCmd.Close acForm, Me.Name, acSaveNo
else
DoCmd.Close acForm, Me.Name, acSaveYes
end if
'~~~~~~~~~~~~~~~

if what you meant is that the RECORD will not save...
'~~~~~~~~~~~~~~~~`
if isnull(me.OwnerInfo) then
if me.dirty then
me.undo
end if
end if

DoCmd.Close acForm, Me.Name
'~~~~~~~~~~~~~~~

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:
I want to change this code slightly so if there is no data in The combo
Box OwnerInfo that the form will not save on closing
Private Sub cmdClose_Click()
If Me.OpenArgs = "ActiveHorses" Then
Me.Requery
Forms!frmActiveHorses.Visible = True
Forms!frmActiveHorses!cbHorseName.Requery
End If
subSetValues
DoCmd.Close acForm, Me.Name
End Sub

Thanks in advance.........Bob Vance



  #4  
Old June 4th, 2006, 06:34 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Change VB Code to Close

Compile error
Method or data member not found!

"strive4peace" "strive4peace2006 at yahoo dot com" wrote in message
...
if what you said is what you meant -- the FORM will not save...
'~~~~~~~~~~~~~~~~`
if isnull(me.OwnerInfo) then
DoCmd.Close acForm, Me.Name, acSaveNo
else
DoCmd.Close acForm, Me.Name, acSaveYes
end if
'~~~~~~~~~~~~~~~

if what you meant is that the RECORD will not save...
'~~~~~~~~~~~~~~~~`
if isnull(me.OwnerInfo) then
if me.dirty then
me.undo
end if
end if

DoCmd.Close acForm, Me.Name
'~~~~~~~~~~~~~~~

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:
I want to change this code slightly so if there is no data in The combo
Box OwnerInfo that the form will not save on closing
Private Sub cmdClose_Click()
If Me.OpenArgs = "ActiveHorses" Then
Me.Requery
Forms!frmActiveHorses.Visible = True
Forms!frmActiveHorses!cbHorseName.Requery
End If
subSetValues
DoCmd.Close acForm, Me.Name
End Sub

Thanks in advance.........Bob Vance



  #5  
Old June 4th, 2006, 06:43 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Change VB Code to Close

Hi Bob,

"The combo box is in SubHorseDetails on the form does that
make a difference...."

yes!

if isnull(me.SubHorseDetails.form.OwnerInfo) then



Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:
Keep getting a compile error after Me.
The combo box is in SubHorseDetails on the form does that make a
difference....Thanx Bob
"strive4peace" "strive4peace2006 at yahoo dot com" wrote in message
...

if what you said is what you meant -- the FORM will not save...
'~~~~~~~~~~~~~~~~`
if isnull(me.OwnerInfo) then
DoCmd.Close acForm, Me.Name, acSaveNo
else
DoCmd.Close acForm, Me.Name, acSaveYes
end if
'~~~~~~~~~~~~~~~

if what you meant is that the RECORD will not save...
'~~~~~~~~~~~~~~~~`
if isnull(me.OwnerInfo) then
if me.dirty then
me.undo
end if
end if

DoCmd.Close acForm, Me.Name
'~~~~~~~~~~~~~~~

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:

I want to change this code slightly so if there is no data in The combo
Box OwnerInfo that the form will not save on closing
Private Sub cmdClose_Click()
If Me.OpenArgs = "ActiveHorses" Then
Me.Requery
Forms!frmActiveHorses.Visible = True
Forms!frmActiveHorses!cbHorseName.Requery
End If
subSetValues
DoCmd.Close acForm, Me.Name
End Sub

Thanks in advance.........Bob Vance




  #6  
Old June 4th, 2006, 07:05 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Change VB Code to Close

I must be stupid, I am still getting a compile error after Me.
Thanx bob
"strive4peace" "strive4peace2006 at yahoo dot com" wrote in message
...
Hi Bob,

"The combo box is in SubHorseDetails on the form does that make a
difference...."

yes!

if isnull(me.SubHorseDetails.form.OwnerInfo) then



Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:
Keep getting a compile error after Me.
The combo box is in SubHorseDetails on the form does that make a
difference....Thanx Bob
"strive4peace" "strive4peace2006 at yahoo dot com" wrote in message
...

if what you said is what you meant -- the FORM will not save...
'~~~~~~~~~~~~~~~~`
if isnull(me.OwnerInfo) then
DoCmd.Close acForm, Me.Name, acSaveNo
else
DoCmd.Close acForm, Me.Name, acSaveYes
end if
'~~~~~~~~~~~~~~~

if what you meant is that the RECORD will not save...
'~~~~~~~~~~~~~~~~`
if isnull(me.OwnerInfo) then
if me.dirty then
me.undo
end if
end if

DoCmd.Close acForm, Me.Name
'~~~~~~~~~~~~~~~

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:

I want to change this code slightly so if there is no data in The combo
Box OwnerInfo that the form will not save on closing
Private Sub cmdClose_Click()
If Me.OpenArgs = "ActiveHorses" Then
Me.Requery
Forms!frmActiveHorses.Visible = True
Forms!frmActiveHorses!cbHorseName.Requery
End If
subSetValues
DoCmd.Close acForm, Me.Name
End Sub

Thanks in advance.........Bob Vance




  #7  
Old June 4th, 2006, 06:12 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Change VB Code to Close -- use Name property to refer to controls

Hi Bob,

After "Me.", you must use the NAME property for the subform
control, not the SourceObject property. After that, you
must have ".form" to specify your want a control on the
subform as opposed to the container itself, then, again, you
must use the NAME property of the OwnerInfo control, not the
ControlSource property

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:
I must be stupid, I am still getting a compile error after Me.
Thanx bob
"strive4peace" "strive4peace2006 at yahoo dot com" wrote in message
...

Hi Bob,

"The combo box is in SubHorseDetails on the form does that make a
difference...."

yes!

if isnull(me.SubHorseDetails.form.OwnerInfo) then



Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:

Keep getting a compile error after Me.
The combo box is in SubHorseDetails on the form does that make a
difference....Thanx Bob
"strive4peace" "strive4peace2006 at yahoo dot com" wrote in message
...


if what you said is what you meant -- the FORM will not save...
'~~~~~~~~~~~~~~~~`
if isnull(me.OwnerInfo) then
DoCmd.Close acForm, Me.Name, acSaveNo
else
DoCmd.Close acForm, Me.Name, acSaveYes
end if
'~~~~~~~~~~~~~~~

if what you meant is that the RECORD will not save...
'~~~~~~~~~~~~~~~~`
if isnull(me.OwnerInfo) then
if me.dirty then
me.undo
end if
end if

DoCmd.Close acForm, Me.Name
'~~~~~~~~~~~~~~~

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Bob wrote:


I want to change this code slightly so if there is no data in The combo
Box OwnerInfo that the form will not save on closing
Private Sub cmdClose_Click()
If Me.OpenArgs = "ActiveHorses" Then
Me.Requery
Forms!frmActiveHorses.Visible = True
Forms!frmActiveHorses!cbHorseName.Requery
End If
subSetValues
DoCmd.Close acForm, Me.Name
End Sub

Thanks in advance.........Bob Vance



  #8  
Old June 4th, 2006, 07:55 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Change VB Code to Close -- use Name property to refer to controls

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


  #9  
Old June 4th, 2006, 09:03 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Change VB Code to Close -- use Name property to refer to controls

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



  #10  
Old June 4th, 2006, 09:32 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Change VB Code to Close -- use Name property to refer to controls

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:44 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.