H
HumanJHawkins
I have a mainform where data is manipulated, and a subform where users
can write notes. But when users do certain things on the main form, I
want to automatically enter a note.
To manually add a note, the user types it (to an unbound field named
NewNote) in and clicks an "Add Note" button. The add note button
triggers this function:
Private Sub AddNote_Click()
If (Trim(Me.NewNote) <> "") Then
Me.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec
Me.vchNoteBy = fOSUserName()
Me.dtmNoteDate = Now
Me.txtNote = Trim(Me.NewNote)
Me.NewNote = ""
Me.Requery
Me.AllowAdditions = False
End If
If Me.Dirty Then
DoCmd.RunCommand acCmdSaveRecord
End If
End Sub
That works fine. So, to support auto-entering notes, I added a public
accessor function in the notes subform:
Public Function AddNote(sNote As String)
Me.NewNote = sNote
AddNote_Click
End Function
Then, from the main form, I should be able to do this, right?
....Formulate note into a string called sNote
Me.Sub_Notes.AddNote(sNote)
However, I get an error that the function is not defined. Can anyone
see what is wrong?
can write notes. But when users do certain things on the main form, I
want to automatically enter a note.
To manually add a note, the user types it (to an unbound field named
NewNote) in and clicks an "Add Note" button. The add note button
triggers this function:
Private Sub AddNote_Click()
If (Trim(Me.NewNote) <> "") Then
Me.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec
Me.vchNoteBy = fOSUserName()
Me.dtmNoteDate = Now
Me.txtNote = Trim(Me.NewNote)
Me.NewNote = ""
Me.Requery
Me.AllowAdditions = False
End If
If Me.Dirty Then
DoCmd.RunCommand acCmdSaveRecord
End If
End Sub
That works fine. So, to support auto-entering notes, I added a public
accessor function in the notes subform:
Public Function AddNote(sNote As String)
Me.NewNote = sNote
AddNote_Click
End Function
Then, from the main form, I should be able to do this, right?
....Formulate note into a string called sNote
Me.Sub_Notes.AddNote(sNote)
However, I get an error that the function is not defined. Can anyone
see what is wrong?