Adding notes to a memo on a subform

mhubbard

Registered User.
Local time
Today, 14:43
Joined
Jul 31, 2002
Messages
25
Hello,
I am having trouble adding notes to a subform. Basically, I want a command botton on the main form and when pressed takes the cursor focus to a subform (Subform is called 'Notes') and the Field is called 'Notepad'
Any suggestions would be a huge help!
 
Set the focus to the subform first, the move the cursor to the control.

Private Sub Command0_Click()
Me.Notes.SetFocus
Notepad.SetFocus
End Sub
 
Thanks Tim.
I entered your code and the focus is going to the subform but it does not like the 'NOTEPAD.SetFocus' I get a ‘runtime error 424’ ‘object required'
Below is my code:

Private Sub Command50_Click()
Dim intstart As Integer
Me.Notes.SetFocus
NOTEPAD.SetFocus
NOTEPAD = Now() & "--" & " " & CurrentUser() & vbCr & vbLf & NOTEPAD
intstart = Len(NOTEPAD)
'Sets the Cursors Starting Position

End Sub

Thanks so much for the help
 
Chage to the blue line.

...
Me.Notes.SetFocus
Me.Notes.Form.NOTEPAD.SetFocus
NOTEPAD = Now() & "--" & " " & ...
 
Hi Tim,
I added the code in blue and I now get a 'run time error 438'.
'Object does not support this property or method'
Sorry to bother you again
Thanks!
 
Try this.

Dim intstart As Integer
Dim strNotePad As String
Me.Notes.SetFocus
Me.Notes.Form.NOTEPAD.SetFocus
strNotePad = Me.Notes.Form.NOTEPAD
strNotePad = Now() & "--" & " " & CurrentUser() & vbCr & vbLf & strNotePad
intstart = Len(strNotePad)
Me.Notes.Form.NOTEPAD = strNotePad
 
It doesn't seem to like the following line
Me.Notes.Form.NOTEPAD.SetFocus
It gives me that error 'object doesn't support property or method'
Thanks!
 
That's strange! Try again with this line.

...
Me.Notes.SetFocus
DoCmd.GoToControl "NOTEPAD"
...
 
Thanks Tim.
I am getting there thanks to your help.
It is working but there are two things I need to change and I am stuck
1) It highlights the whole Notepad field and I want the cursor to stop after it stamps the user name/date and not highlight the whole field.
2) If there is a null in the Notepad field I get an error. 'Invalid use of a null'
Thanks again!
 
Try this.

...
Me.Notes.SetFocus
Me.Notes.Form.NOTEPAD.SetFocus
If Not IsNull(Me.Notes.Form.NOTEPAD) Then
strNotePad = Me.Notes.Form.NOTEPAD
Else
strNotePad = ""
End If)

strNotePad = Now() & "--" & " " & CurrentUser() & vbCr & vbLf & strNotePad
Me.Notes.Form.NOTEPAD.SelStart = Len(strNotePad)
...
 
Hi Tim,
I altered the code a little to get the date/time stamp. The only thing left is that the whole field is highlighted.
Any suggestions?
Thanks Again
Private Sub Command50_Click()
Dim intstart As Integer
Dim strNotePad As String
Me.Notes.Form.NOTEPAD.SetFocus
If Not IsNull(Me.Notes.Form.NOTEPAD) Then
strNotePad = Me.Notes.Form.NOTEPAD
Else
strNotePad = ""
End If
strNotePad = Now() & "--" & " " & CurrentUser() & vbCr & vbLf & strNotePad
Me.Notes.Form.NOTEPAD.SelStart = Len(strNotePad)

Me.Notes.Form.NOTEPAD = strNotePad

End Sub
 
You have switch the last 2 lines like this.

...
strNotePad = Now() & "--" & " " & CurrentUser() & vbCr & vbLf & strNotePad

Me.Notes.Form.NOTEPAD = strNotePad
Me.Notes.Form.NOTEPAD.SelStart = Len(strNotePad)
 

Users who are viewing this thread

Back
Top Bottom