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  

Help with requery/update



 
 
Thread Tools Display Modes
  #1  
Old March 3rd, 2010, 03:07 PM posted to microsoft.public.access.forms
Mary Beth[_2_]
external usenet poster
 
Posts: 44
Default Help with requery/update

I have a form called frmAuthorization with a combo box drop down menu called
RNAsssor. I want to send an email to the Assessor chosen in the combo box
with a report attached containing the data just entered on the form. I have
a macro set up to send the report in an email.

In the On Exit event of the combo box I have:

DoCmd.Requery
DoCmd.RunMacro "mcrInitialAssessment.Initial"

The problem is when I exit the combo box, it does the requery and all of the
data disappears from the form, and the email is not sent. When I take the
DoCmd.Requery out of the code, the email and report macro works, but there is
no data in the report. This only works properly when I reopen the form, look
for the existing record, and choose the assessor again.

Any thoughts, or any additional info you may need to help me?

Thanks,

Mary Beth




  #2  
Old March 3rd, 2010, 06:49 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Help with requery/update

Mary Beth -

I suspect that the data you have entered has not yet been saved when you run
the report, and that would be why the data is blank. If that is the case,
replace the DoCmd.Requery with a Me.Dirty = FALSE, which saves the current
record.

If the combobox is used just to enter data, then I don't know why a requery
would be helpful. (Whereas if an unbound combo box is used to select a
record, then a requery would be needed to display the data based on the combo
box.)

--
Daryl S


"Mary Beth" wrote:

I have a form called frmAuthorization with a combo box drop down menu called
RNAsssor. I want to send an email to the Assessor chosen in the combo box
with a report attached containing the data just entered on the form. I have
a macro set up to send the report in an email.

In the On Exit event of the combo box I have:

DoCmd.Requery
DoCmd.RunMacro "mcrInitialAssessment.Initial"

The problem is when I exit the combo box, it does the requery and all of the
data disappears from the form, and the email is not sent. When I take the
DoCmd.Requery out of the code, the email and report macro works, but there is
no data in the report. This only works properly when I reopen the form, look
for the existing record, and choose the assessor again.

Any thoughts, or any additional info you may need to help me?

Thanks,

Mary Beth




  #3  
Old March 4th, 2010, 03:56 PM posted to microsoft.public.access.forms
Mary Beth[_2_]
external usenet poster
 
Posts: 44
Default Help with requery/update

Thanks, Daryl, the Me.Dirty = False worked perfectly. What does Me.Dirty
actually mean other than the fact that it saved the record? I used
DoCmd.Requery in order to get the newly entered data into the report that I
am attaching to the email, otherwise either the data was not in the report at
all or the data from a previous record was in the report and the email
trigger wasn't working. So is the Me.Dirty the way to go for this situation
instead of DoCmd.Requery in the future? The combo box is bound and used to
choose a nurse assessor, then the email with the data goes to that assessor.

Thanks,

Mary Beth

"Daryl S" wrote:

Mary Beth -

I suspect that the data you have entered has not yet been saved when you run
the report, and that would be why the data is blank. If that is the case,
replace the DoCmd.Requery with a Me.Dirty = FALSE, which saves the current
record.

If the combobox is used just to enter data, then I don't know why a requery
would be helpful. (Whereas if an unbound combo box is used to select a
record, then a requery would be needed to display the data based on the combo
box.)

--
Daryl S


"Mary Beth" wrote:

I have a form called frmAuthorization with a combo box drop down menu called
RNAsssor. I want to send an email to the Assessor chosen in the combo box
with a report attached containing the data just entered on the form. I have
a macro set up to send the report in an email.

In the On Exit event of the combo box I have:

DoCmd.Requery
DoCmd.RunMacro "mcrInitialAssessment.Initial"

The problem is when I exit the combo box, it does the requery and all of the
data disappears from the form, and the email is not sent. When I take the
DoCmd.Requery out of the code, the email and report macro works, but there is
no data in the report. This only works properly when I reopen the form, look
for the existing record, and choose the assessor again.

Any thoughts, or any additional info you may need to help me?

Thanks,

Mary Beth




  #4  
Old March 4th, 2010, 05:06 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Help with requery/update

Mary Beth -

The Me.Dirty indicates that there are changes on the form that have not been
saved to the database. Setting Me.Dirty = FALSE saves the changes to the
database. If you run the report (which pulls from the database) while there
are changes in the form only, then those changes are not seen by tghe report,
which only looks at the database.

The DoCmd.Requery does the opposite - it pulls the data from the database
and displays it on the form. This is needed especially in cases where we run
a query to append or update the database rather than saving changes on a
form. The form will not display any data changed in the database unless we
requery the database.

Hope that helps!

--
Daryl S


"Mary Beth" wrote:

Thanks, Daryl, the Me.Dirty = False worked perfectly. What does Me.Dirty
actually mean other than the fact that it saved the record? I used
DoCmd.Requery in order to get the newly entered data into the report that I
am attaching to the email, otherwise either the data was not in the report at
all or the data from a previous record was in the report and the email
trigger wasn't working. So is the Me.Dirty the way to go for this situation
instead of DoCmd.Requery in the future? The combo box is bound and used to
choose a nurse assessor, then the email with the data goes to that assessor.

Thanks,

Mary Beth

"Daryl S" wrote:

Mary Beth -

I suspect that the data you have entered has not yet been saved when you run
the report, and that would be why the data is blank. If that is the case,
replace the DoCmd.Requery with a Me.Dirty = FALSE, which saves the current
record.

If the combobox is used just to enter data, then I don't know why a requery
would be helpful. (Whereas if an unbound combo box is used to select a
record, then a requery would be needed to display the data based on the combo
box.)

--
Daryl S


"Mary Beth" wrote:

I have a form called frmAuthorization with a combo box drop down menu called
RNAsssor. I want to send an email to the Assessor chosen in the combo box
with a report attached containing the data just entered on the form. I have
a macro set up to send the report in an email.

In the On Exit event of the combo box I have:

DoCmd.Requery
DoCmd.RunMacro "mcrInitialAssessment.Initial"

The problem is when I exit the combo box, it does the requery and all of the
data disappears from the form, and the email is not sent. When I take the
DoCmd.Requery out of the code, the email and report macro works, but there is
no data in the report. This only works properly when I reopen the form, look
for the existing record, and choose the assessor again.

Any thoughts, or any additional info you may need to help me?

Thanks,

Mary Beth




  #5  
Old March 4th, 2010, 05:37 PM posted to microsoft.public.access.forms
Mary Beth[_2_]
external usenet poster
 
Posts: 44
Default Help with requery/update

Yes, this helps alot. Thanks for your explanation. Mary Beth

"Daryl S" wrote:

Mary Beth -

The Me.Dirty indicates that there are changes on the form that have not been
saved to the database. Setting Me.Dirty = FALSE saves the changes to the
database. If you run the report (which pulls from the database) while there
are changes in the form only, then those changes are not seen by tghe report,
which only looks at the database.

The DoCmd.Requery does the opposite - it pulls the data from the database
and displays it on the form. This is needed especially in cases where we run
a query to append or update the database rather than saving changes on a
form. The form will not display any data changed in the database unless we
requery the database.

Hope that helps!

--
Daryl S


"Mary Beth" wrote:

Thanks, Daryl, the Me.Dirty = False worked perfectly. What does Me.Dirty
actually mean other than the fact that it saved the record? I used
DoCmd.Requery in order to get the newly entered data into the report that I
am attaching to the email, otherwise either the data was not in the report at
all or the data from a previous record was in the report and the email
trigger wasn't working. So is the Me.Dirty the way to go for this situation
instead of DoCmd.Requery in the future? The combo box is bound and used to
choose a nurse assessor, then the email with the data goes to that assessor.

Thanks,

Mary Beth

"Daryl S" wrote:

Mary Beth -

I suspect that the data you have entered has not yet been saved when you run
the report, and that would be why the data is blank. If that is the case,
replace the DoCmd.Requery with a Me.Dirty = FALSE, which saves the current
record.

If the combobox is used just to enter data, then I don't know why a requery
would be helpful. (Whereas if an unbound combo box is used to select a
record, then a requery would be needed to display the data based on the combo
box.)

--
Daryl S


"Mary Beth" wrote:

I have a form called frmAuthorization with a combo box drop down menu called
RNAsssor. I want to send an email to the Assessor chosen in the combo box
with a report attached containing the data just entered on the form. I have
a macro set up to send the report in an email.

In the On Exit event of the combo box I have:

DoCmd.Requery
DoCmd.RunMacro "mcrInitialAssessment.Initial"

The problem is when I exit the combo box, it does the requery and all of the
data disappears from the form, and the email is not sent. When I take the
DoCmd.Requery out of the code, the email and report macro works, but there is
no data in the report. This only works properly when I reopen the form, look
for the existing record, and choose the assessor again.

Any thoughts, or any additional info you may need to help me?

Thanks,

Mary Beth




 




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


All times are GMT +1. The time now is 09:34 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.