Re: Method or Data Member Not found

Tech-Archive recommends: Speed Up your PC by fixing your registry



ONE more thing... I hope. This is turning out to be more trouble than it is
worth!

Okay, so here is the code I have:

Private Sub Command69_Click()
Me.gNotes.Locked = False
Me.gNotes = Now() & "--" & Environ("Username") & "--" & vbCrLf
Me.gNotes.SetFocus
Me.gNotes.SelStart = Len(Me.gNotes.Text)
End Sub

It works the first time I hit the button, but the second time, it puts the
date/time/username at the TOP of the memo field, and pushes the rest down.
That would be fine, except the cursor goes to the bottom of the memo
field...so it looks like this:

4/17/2009 2:00:16 PM--kmccracken--
4/17/2009 2:00:09 PM--kmccracken--
working 123_

This would be okay if the cursor ended up at the end of the first line... I
would rather it go to the end of the field, add the next date and time and
then it would work.

Is there something I can put in the code to make it add the next date and
time below the first set of data, instead of at the top?

Thanks

"Stuart McCall" wrote:

"lsgKelly" <lsgKelly@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1176B62E-617A-4E59-85F9-4239C4CFEF72@xxxxxxxxxxxxxxxx
This works! Except one thing, once it puts in the Date/Time/Username, it
doesn't go to the end of the data so they are able to type. You actually
have to click in the box where you want to start typing. Is there a way
to
move the cursor to the end of the data, so when they start typing, it
begins
after the Date/Username?

Me.gnotes.SetFocus
Me.gnotes.SelStart = Len(Me.gnotes.Text)


Okay, I got this one to work. Evidently, the name of the control and
the
label name have to be the same. :)
Because you followed that with a smiley, I'm going to assume you know
this
isn't the case.

I'm serious. that is exactly what I did. The label was "Comments" and
the
field name is gNotes. As soon as I changed "Comments" to gNotes, I no
longer
got the error. I put in a smiley because I couldn't believe that was why
I
was getting the error. i thought maybe it was something I should know!

If (as you suggest) you name a control, say, Fred, then try to name a label
on the same form Fred, Access will (quite rightly) not allow it.


Really appreciate your help! Thank you!


You're welcome. Glad I could help.

Kelly



"Stuart McCall" wrote:

Answers inline:

"lsgKelly" <lsgKelly@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E1AC3C5B-5D91-4AE9-9E34-70D2548E3238@xxxxxxxxxxxxxxxx
Thanks Stuart,

Okay, I got this one to work. Evidently, the name of the control and
the
label name have to be the same. :)
Because you followed that with a smiley, I'm going to assume you know
this
isn't the case.


Private Sub Command70_Click()
Me.gNotes.Locked = False
Me.gNotes = Now() & "--" & CurrentUser() & "--" & vbCrLf &

If you want just the date and not the time portion, use the Date()
function
instead of Now().

"-----------------------------------------------------------------------------------------------------------------------------------------------"
& vbCrLf & Me.gNotes
Me.gNotes.Locked = True
Move the above line to the control's AfterUpdate event. This event only
fires if the user makes a change, then tries to move away from the
control,
which is exactly the behaviour you describe.

End Sub
<snip>






.


Quantcast