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  

on exit event



 
 
Thread Tools Display Modes
  #11  
Old August 23rd, 2004, 06:17 PM
external usenet poster
 
Posts: n/a
Default

I am confused, I don't see an On Enter property?
-----Original Message-----
There is an On Enter property for the main form's

control that holds the
subform. You're looking at the form that is serving as

the subform -- and
no, it doesn't contain this property.

--

Ken Snell
MS ACCESS MVP

wrote in message
...
Therer is no OnEnter event for the subform and the Got
Focus event did not work either.
here is my code:

If IsNull(Me.Applicant!txtApplicant1) Then
MsgBox "You must enter the Applicant's Last Name"
Cancel = True
Me!Applicant!txtApplicant1.SetFocus
End If
-----Original Message-----
What I suggest is that you put code in the subform's

OnEnter event that
tests for the presence or absence of info in that

textbox. If there is info,
then the code ends. If there is not info, then the

code
displays the error
message, sets the focus back to that control, and then

ends.

--

Ken Snell
MS ACCESS MVP

wrote in message
...
I added the msgbox in the onexit for the control of

the
txtApplicant1 because if the userclicks on the

subform
and enters data I get an error message that the main

form
required data in the autonumber (the autonumber does

not
increase until data has been entered in the main

form).
Basically, this works but when I try to click on

Find
or
Close I without any data entered in the

txtApplicant1 I
recieve the message box to enter data. Hope this

makes
more sense, and thanks for your help.
-----Original Message-----
I am not understanding. You don't want to force an

entry
into the textbox
before the user can click into the subform? Or you

do
want to force the
entry? I do not unsderstand why the control's
BeforeUpdate event "stopping"
the form's BeforeUpdate event is bad?

Perhaps you can explain in more detail what you

want
the
form to do and what
you want the user to do.

--

Ken Snell
MS ACCESS MVP

wrote in

message
...
In the BeforeUpdate event of the form I have

code to
ask
the user if they would like to save the current

record,
before adding date to the subform.
If MsgBox("Save Changes to Applicant Record?",
vbYesNo) =
vbNo Then
'Cancel = True
Me.Undo
End If
I added this because when I clicked on a field in

the
subform before entering any data in the mainform

I
received an error - to do with the primary key on

the
main form not having any data - it is an

autonumber. Is
there any way other way to check if data was not
entered
in the Applicant1 text box. If I did put the

code in
the
OnBeforeUpdate it stopped the OnBeforeUpdate for

the
form
to stop working...thanks again
-----Original Message-----
Additionally, use the control's OnBeforeUpdate

event
for
your code, not the
OnExit event.

--

Ken Snell
MS ACCESS MVP

"help"

wrote
in
message
...
I have added code to verify a user is

entering in
information for an Applicant form to

correspond
with
sub-
form. However this msgbox continously pops up

and
won't
let me click the close button or find in case

the
user
did not want to add a new applicant. The

Msgbox
is
in
the
on exit of the control of the Applicant's last

name.

ex.
If IsNull([Applicant1 Last Name]) Then
MsgBox "You must enter the Applicant's Last

Name"
DoCmd.CancelEvent



.



.



.



.

  #12  
Old August 23rd, 2004, 06:26 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

Open the main form in design view. Click on the outside of the control that
"is" the subform (contains the subform). Click on Properties icon on
toolbar. Click on Event tab. You'll see it there.

--

Ken Snell
MS ACCESS MVP

wrote in message
...
I am confused, I don't see an On Enter property?
-----Original Message-----
There is an On Enter property for the main form's

control that holds the
subform. You're looking at the form that is serving as

the subform -- and
no, it doesn't contain this property.

--

Ken Snell
MS ACCESS MVP

wrote in message
...
Therer is no OnEnter event for the subform and the Got
Focus event did not work either.
here is my code:

If IsNull(Me.Applicant!txtApplicant1) Then
MsgBox "You must enter the Applicant's Last Name"
Cancel = True
Me!Applicant!txtApplicant1.SetFocus
End If
-----Original Message-----
What I suggest is that you put code in the subform's
OnEnter event that
tests for the presence or absence of info in that
textbox. If there is info,
then the code ends. If there is not info, then the

code
displays the error
message, sets the focus back to that control, and then
ends.

--

Ken Snell
MS ACCESS MVP

wrote in message
...
I added the msgbox in the onexit for the control of

the
txtApplicant1 because if the userclicks on the

subform
and enters data I get an error message that the main
form
required data in the autonumber (the autonumber does
not
increase until data has been entered in the main

form).
Basically, this works but when I try to click on

Find
or
Close I without any data entered in the

txtApplicant1 I
recieve the message box to enter data. Hope this

makes
more sense, and thanks for your help.
-----Original Message-----
I am not understanding. You don't want to force an
entry
into the textbox
before the user can click into the subform? Or you

do
want to force the
entry? I do not unsderstand why the control's
BeforeUpdate event "stopping"
the form's BeforeUpdate event is bad?

Perhaps you can explain in more detail what you

want
the
form to do and what
you want the user to do.

--

Ken Snell
MS ACCESS MVP

wrote in

message
...
In the BeforeUpdate event of the form I have

code to
ask
the user if they would like to save the current
record,
before adding date to the subform.
If MsgBox("Save Changes to Applicant Record?",
vbYesNo) =
vbNo Then
'Cancel = True
Me.Undo
End If
I added this because when I clicked on a field in
the
subform before entering any data in the mainform

I
received an error - to do with the primary key on
the
main form not having any data - it is an
autonumber. Is
there any way other way to check if data was not
entered
in the Applicant1 text box. If I did put the

code in
the
OnBeforeUpdate it stopped the OnBeforeUpdate for

the
form
to stop working...thanks again
-----Original Message-----
Additionally, use the control's OnBeforeUpdate
event
for
your code, not the
OnExit event.

--

Ken Snell
MS ACCESS MVP

"help"

wrote
in
message
...
I have added code to verify a user is

entering in
information for an Applicant form to

correspond
with
sub-
form. However this msgbox continously pops up

and
won't
let me click the close button or find in case

the
user
did not want to add a new applicant. The

Msgbox
is
in
the
on exit of the control of the Applicant's last
name.

ex.
If IsNull([Applicant1 Last Name]) Then
MsgBox "You must enter the Applicant's Last

Name"
DoCmd.CancelEvent



.



.



.



.



  #13  
Old August 23rd, 2004, 07:04 PM
external usenet poster
 
Posts: n/a
Default

I found it and it works great! You have been such a big
help. Could you answer another question. How do I find on
the subform if the FindRecord is on the Main Form. I have
the Find Record looking in the subform but it states no
records are found. Thanks again.
-----Original Message-----
I am confused, I don't see an On Enter property?
-----Original Message-----
There is an On Enter property for the main form's

control that holds the
subform. You're looking at the form that is serving as

the subform -- and
no, it doesn't contain this property.

--

Ken Snell
MS ACCESS MVP

wrote in message
...
Therer is no OnEnter event for the subform and the Got
Focus event did not work either.
here is my code:

If IsNull(Me.Applicant!txtApplicant1) Then
MsgBox "You must enter the Applicant's Last Name"
Cancel = True
Me!Applicant!txtApplicant1.SetFocus
End If
-----Original Message-----
What I suggest is that you put code in the subform's
OnEnter event that
tests for the presence or absence of info in that
textbox. If there is info,
then the code ends. If there is not info, then the

code
displays the error
message, sets the focus back to that control, and

then
ends.

--

Ken Snell
MS ACCESS MVP

wrote in

message
...
I added the msgbox in the onexit for the control

of
the
txtApplicant1 because if the userclicks on the

subform
and enters data I get an error message that the

main
form
required data in the autonumber (the autonumber

does
not
increase until data has been entered in the main

form).
Basically, this works but when I try to click on

Find
or
Close I without any data entered in the

txtApplicant1 I
recieve the message box to enter data. Hope this

makes
more sense, and thanks for your help.
-----Original Message-----
I am not understanding. You don't want to force an
entry
into the textbox
before the user can click into the subform? Or

you
do
want to force the
entry? I do not unsderstand why the control's
BeforeUpdate event "stopping"
the form's BeforeUpdate event is bad?

Perhaps you can explain in more detail what you

want
the
form to do and what
you want the user to do.

--

Ken Snell
MS ACCESS MVP

wrote in

message
...
In the BeforeUpdate event of the form I have

code to
ask
the user if they would like to save the current
record,
before adding date to the subform.
If MsgBox("Save Changes to Applicant Record?",
vbYesNo) =
vbNo Then
'Cancel = True
Me.Undo
End If
I added this because when I clicked on a field

in
the
subform before entering any data in the

mainform
I
received an error - to do with the primary key

on
the
main form not having any data - it is an
autonumber. Is
there any way other way to check if data was not
entered
in the Applicant1 text box. If I did put the

code in
the
OnBeforeUpdate it stopped the OnBeforeUpdate

for
the
form
to stop working...thanks again
-----Original Message-----
Additionally, use the control's OnBeforeUpdate
event
for
your code, not the
OnExit event.

--

Ken Snell
MS ACCESS MVP

"help"

wrote
in
message
...
I have added code to verify a user is

entering in
information for an Applicant form to

correspond
with
sub-
form. However this msgbox continously pops

up
and
won't
let me click the close button or find in

case
the
user
did not want to add a new applicant. The

Msgbox
is
in
the
on exit of the control of the Applicant's

last
name.

ex.
If IsNull([Applicant1 Last Name]) Then
MsgBox "You must enter the Applicant's Last

Name"
DoCmd.CancelEvent



.



.



.



.

.

  #14  
Old August 23rd, 2004, 07:15 PM
external usenet poster
 
Posts: n/a
Default

I found it and it works great! You have been such a big
help. Could you answer another question. How do I find on
the subform if the FindRecord is on the Main Form. I have
the Find Record looking in the subform but it states no
records are found. Thanks again.

-----Original Message-----
Open the main form in design view. Click on the outside

of the control that
"is" the subform (contains the subform). Click on

Properties icon on
toolbar. Click on Event tab. You'll see it there.

--

Ken Snell
MS ACCESS MVP

wrote in message
...
I am confused, I don't see an On Enter property?
-----Original Message-----
There is an On Enter property for the main form's

control that holds the
subform. You're looking at the form that is serving as

the subform -- and
no, it doesn't contain this property.

--

Ken Snell
MS ACCESS MVP

wrote in message
...
Therer is no OnEnter event for the subform and the

Got
Focus event did not work either.
here is my code:

If IsNull(Me.Applicant!txtApplicant1) Then
MsgBox "You must enter the Applicant's Last Name"
Cancel = True
Me!Applicant!txtApplicant1.SetFocus
End If
-----Original Message-----
What I suggest is that you put code in the

subform's
OnEnter event that
tests for the presence or absence of info in that
textbox. If there is info,
then the code ends. If there is not info, then the

code
displays the error
message, sets the focus back to that control, and

then
ends.

--

Ken Snell
MS ACCESS MVP

wrote in

message
...
I added the msgbox in the onexit for the control

of
the
txtApplicant1 because if the userclicks on the

subform
and enters data I get an error message that the

main
form
required data in the autonumber (the autonumber

does
not
increase until data has been entered in the main

form).
Basically, this works but when I try to click on

Find
or
Close I without any data entered in the

txtApplicant1 I
recieve the message box to enter data. Hope this

makes
more sense, and thanks for your help.
-----Original Message-----
I am not understanding. You don't want to force

an
entry
into the textbox
before the user can click into the subform? Or

you
do
want to force the
entry? I do not unsderstand why the control's
BeforeUpdate event "stopping"
the form's BeforeUpdate event is bad?

Perhaps you can explain in more detail what you

want
the
form to do and what
you want the user to do.

--

Ken Snell
MS ACCESS MVP

wrote in

message
...
In the BeforeUpdate event of the form I have

code to
ask
the user if they would like to save the

current
record,
before adding date to the subform.
If MsgBox("Save Changes to Applicant Record?",
vbYesNo) =
vbNo Then
'Cancel = True
Me.Undo
End If
I added this because when I clicked on a

field in
the
subform before entering any data in the

mainform
I
received an error - to do with the primary

key on
the
main form not having any data - it is an
autonumber. Is
there any way other way to check if data was

not
entered
in the Applicant1 text box. If I did put the

code in
the
OnBeforeUpdate it stopped the OnBeforeUpdate

for
the
form
to stop working...thanks again
-----Original Message-----
Additionally, use the control's

OnBeforeUpdate
event
for
your code, not the
OnExit event.

--

Ken Snell
MS ACCESS MVP

"help"

wrote
in
message
news:2d3b01c486d1$bb9a8790

...
I have added code to verify a user is

entering in
information for an Applicant form to

correspond
with
sub-
form. However this msgbox continously pops

up
and
won't
let me click the close button or find in

case
the
user
did not want to add a new applicant. The

Msgbox
is
in
the
on exit of the control of the Applicant's

last
name.

ex.
If IsNull([Applicant1 Last Name]) Then
MsgBox "You must enter the Applicant's Last

Name"
DoCmd.CancelEvent



.



.



.



.



.

  #15  
Old August 23rd, 2004, 07:25 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

I'm sorry, I'm not understanding your question. Can you post some code that
you're trying to use so that I can see what you're trying to do?

--

Ken Snell
MS ACCESS MVP

wrote in message
...
I found it and it works great! You have been such a big
help. Could you answer another question. How do I find on
the subform if the FindRecord is on the Main Form. I have
the Find Record looking in the subform but it states no
records are found. Thanks again.
-----Original Message-----
I am confused, I don't see an On Enter property?
-----Original Message-----
There is an On Enter property for the main form's

control that holds the
subform. You're looking at the form that is serving as

the subform -- and
no, it doesn't contain this property.

--

Ken Snell
MS ACCESS MVP



  #16  
Old August 23rd, 2004, 07:53 PM
external usenet poster
 
Posts: n/a
Default

Private Sub cmdFindRecord_Click()
On Error GoTo Err_cmdFindRecord_Click


Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, ,
acMenuVer70

Exit_cmdFindRecord_Click:
Exit Sub

Err_cmdFindRecord_Click:
MsgBox Err.Description
Resume Exit_cmdFindRecord_Click

End Sub

This is the code for the Find Record command button.
However, it does not find records for the sub form,
although I can choose to look in the subform. thanks.
-----Original Message-----
I'm sorry, I'm not understanding your question. Can you

post some code that
you're trying to use so that I can see what you're

trying to do?

--

Ken Snell
MS ACCESS MVP

wrote in message
...
I found it and it works great! You have been such a big
help. Could you answer another question. How do I find

on
the subform if the FindRecord is on the Main Form. I

have
the Find Record looking in the subform but it states no
records are found. Thanks again.
-----Original Message-----
I am confused, I don't see an On Enter property?
-----Original Message-----
There is an On Enter property for the main form's
control that holds the
subform. You're looking at the form that is serving

as
the subform -- and
no, it doesn't contain this property.

--

Ken Snell
MS ACCESS MVP



.

  #17  
Old August 23rd, 2004, 08:50 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

Are you trying to run this code from the main form and find something on the
subform? Why not put a command button on the subform that will do this for
you, and use the same code?

--

Ken Snell
MS ACCESS MVP

wrote in message
...
Private Sub cmdFindRecord_Click()
On Error GoTo Err_cmdFindRecord_Click


Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, ,
acMenuVer70

Exit_cmdFindRecord_Click:
Exit Sub

Err_cmdFindRecord_Click:
MsgBox Err.Description
Resume Exit_cmdFindRecord_Click

End Sub

This is the code for the Find Record command button.
However, it does not find records for the sub form,
although I can choose to look in the subform. thanks.
-----Original Message-----
I'm sorry, I'm not understanding your question. Can you

post some code that
you're trying to use so that I can see what you're

trying to do?

--

Ken Snell
MS ACCESS MVP

wrote in message
...
I found it and it works great! You have been such a big
help. Could you answer another question. How do I find

on
the subform if the FindRecord is on the Main Form. I

have
the Find Record looking in the subform but it states no
records are found. Thanks again.
-----Original Message-----
I am confused, I don't see an On Enter property?
-----Original Message-----
There is an On Enter property for the main form's
control that holds the
subform. You're looking at the form that is serving

as
the subform -- and
no, it doesn't contain this property.

--

Ken Snell
MS ACCESS MVP



.



 




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
AfterUpdate event of Calendar Control in Access 2000 not firing as expected? Gary Using Forms 3 July 2nd, 2004 07:53 PM
Need help with Access decision aualias General Discussion 23 June 21st, 2004 02:04 AM
raise event of access control vdavid General Discussion 3 June 15th, 2004 03:35 PM
re; Worksheet_SelectionChange goes cold Rob General Discussion 1 June 12th, 2004 01:43 AM
Array Functions Alan Beban Worksheet Functions 11 April 14th, 2004 07:06 AM


All times are GMT +1. The time now is 05:19 PM.


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