Embedded macro not allowing data entry

  • Thread starter BenEl via AccessMonster.com
  • Start date
B

BenEl via AccessMonster.com

I have a split form (frmTasks) that contains an embedded macro. The macro
opens a second form (frmModifyTasks) when the user double clicks on the ID.
This has been working well.

The user has requested tracking the comments field changes on the
frmModifyTasks. To do this I have created a one (tblTasks) to many
(tblComments) relationship. On frmModifyTasks I have included 2 subforms
using tblComments to allow the user to enter new comments into a blank field
and to show past comments. In order to show only a blank field to enter new
comments, subform frmNewComment is displayed. In order to show all past
comments, subform frmPastComments is displayed. This method is working well
ONLY when I open the from directly from the listed Access Objects. When I
open it using the macro double click, the subform frmNewComment opens with
the previously entered comment in it.

Here is my macro:

OnError Next,
[Form].[Dirty] RunCommand SaveRecord
[MacroError].[Number]<>0 MsgBox =[MacroError].[Description], Yes,
None,
StopMacro
OnError Fail,

OpenForm frmModifyTask, Form, , ="[TaskID]=" & Nz [TaskID],
0), Edit, Normal
Not IsNull([TaskID]) SetTempVar CurrentID, [TaskID]
IsNull([TaskID]) SetTempVar CurrentID, Nz(DMax("[TaskID]",[Form].
[RecordSource]),0)
Requery
SearchForRecord , , First, ="[TaskID]=" & [TempVars]![CurrentID]
RemoveTempVar CurrentID

How can I get the subform frmNewComment to open blank?


Thanks!
 
B

BenEl via AccessMonster.com

Can anyone help with this?

Thanks!

I have a split form (frmTasks) that contains an embedded macro. The macro
opens a second form (frmModifyTasks) when the user double clicks on the ID.
This has been working well.

The user has requested tracking the comments field changes on the
frmModifyTasks. To do this I have created a one (tblTasks) to many
(tblComments) relationship. On frmModifyTasks I have included 2 subforms
using tblComments to allow the user to enter new comments into a blank field
and to show past comments. In order to show only a blank field to enter new
comments, subform frmNewComment is displayed. In order to show all past
comments, subform frmPastComments is displayed. This method is working well
ONLY when I open the from directly from the listed Access Objects. When I
open it using the macro double click, the subform frmNewComment opens with
the previously entered comment in it.

Here is my macro:

OnError Next,
[Form].[Dirty] RunCommand SaveRecord
[MacroError].[Number]<>0 MsgBox =[MacroError].[Description], Yes,
None,
StopMacro
OnError Fail,

OpenForm frmModifyTask, Form, , ="[TaskID]=" & Nz [TaskID],
0), Edit, Normal
Not IsNull([TaskID]) SetTempVar CurrentID, [TaskID]
IsNull([TaskID]) SetTempVar CurrentID, Nz(DMax("[TaskID]",[Form].
[RecordSource]),0)
Requery
SearchForRecord , , First, ="[TaskID]=" & [TempVars]![CurrentID]
RemoveTempVar CurrentID

How can I get the subform frmNewComment to open blank?

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top