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  

What's wrong with this Sub?



 
 
Thread Tools Display Modes
  #1  
Old December 17th, 2006, 04:29 AM posted to microsoft.public.access.forms
JustMe
external usenet poster
 
Posts: 96
Default What's wrong with this Sub?

Private Sub btnCommentSubmit_Click()
On Error GoTo Err_btnCommentSubmit_Click

Me.CommentDate = Now
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Exit_btnCommentSubmit_Click:
Exit Sub

Err_btnCommentSubmit_Click:
MsgBox Err.Description
Resume Exit_btnCommentSubmit_Click

End Sub






I get "The DoMenuItem Action was Canceled" Error

??

Thank you!
  #2  
Old December 17th, 2006, 04:41 AM posted to microsoft.public.access.forms
Tom Wickerath
external usenet poster
 
Posts: 3,914
Default What's wrong with this Sub?

Try a different method of saving the record, by setting the dirty property to
false:


Private Sub btnCommentSubmit_Click()
On Error GoTo Err_btnCommentSubmit_Click

Me.CommentDate = Now
Me.Dirty = False

Exit_btnCommentSubmit_Click:
Exit Sub

Err_btnCommentSubmit_Click:
MsgBox Err.Description
Resume Exit_btnCommentSubmit_Click

End Sub


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/ex...tributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

"justme" wrote:

Private Sub btnCommentSubmit_Click()
On Error GoTo Err_btnCommentSubmit_Click

Me.CommentDate = Now
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Exit_btnCommentSubmit_Click:
Exit Sub

Err_btnCommentSubmit_Click:
MsgBox Err.Description
Resume Exit_btnCommentSubmit_Click

End Sub


I get "The DoMenuItem Action was Canceled" Error

??

Thank you!

  #3  
Old December 17th, 2006, 05:09 AM posted to microsoft.public.access.forms
JustMe
external usenet poster
 
Posts: 96
Default What's wrong with this Sub?


Hi

Thanks for answering! I replaced my sub, opened my form, entered a comment
in the comment text box, and hit the submit button. The date went into the
CommentDate field ok. but then the form doesn't close. I'm getting

"The setting you entered isn't valid for this property" error

What can I do?

Thanks!



  #4  
Old December 17th, 2006, 05:22 AM posted to microsoft.public.access.forms
Tom Wickerath
external usenet poster
 
Posts: 3,914
Default What's wrong with this Sub?

Can we assume that the CommentDate field is a Date/Time datatype? If not, it
needs to be, since you are setting the field = Now.


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/ex...tributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

"justme" wrote:


Hi

Thanks for answering! I replaced my sub, opened my form, entered a comment
in the comment text box, and hit the submit button. The date went into the
CommentDate field ok. but then the form doesn't close. I'm getting

"The setting you entered isn't valid for this property" error

What can I do?

Thanks!

  #5  
Old December 19th, 2006, 05:59 AM posted to microsoft.public.access.forms
JustMe
external usenet poster
 
Posts: 96
Default What's wrong with this Sub?

Yes, the field type is a date/time General Date (Date and time) already. When
I click submit, the date goes in the box and the error message comes up. I
click OK to the message, and then have to cancel out of my form. but when I
go into my table, the comment and date are there just fine.

It Is there anything else it could be?
  #6  
Old December 19th, 2006, 09:48 PM posted to microsoft.public.access.forms
Tom Wickerath
external usenet poster
 
Posts: 3,914
Default What's wrong with this Sub?

Sorry to hear that you are still having problems with this. Right now, I'm
not able to provide much help. I've been without power at my home since early
Friday morning last week. I live in the Seattle area; you may have heard on
the news about severe windstorm damage in the Pacific Northwest. I had come
into the office on Saturday evening, to get out of the cold and cook some
dinner in the microwave, which is when I attempted to answer your question
the first time.

You can go ahead and send me a zipped copy of your database, and I will take
a look at it when I get power back. My e-mail address is shown on the bottom
of the contributor's page indicated in my sig. line below. (I'm replying to
this message from my office, where we do have power, but I really cannot
spend normal work hours helping on a newsgroup issue).


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/ex...tributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

"justme" wrote:

Yes, the field type is a date/time General Date (Date and time) already. When
I click submit, the date goes in the box and the error message comes up. I
click OK to the message, and then have to cancel out of my form. but when I
go into my table, the comment and date are there just fine.

It Is there anything else it could be?

 




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 03:46 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.