SetFocus on last record of a subform

BananasInPajamas

New member
Local time
Yesterday, 22:56
Joined
Apr 4, 2011
Messages
9
I have a main form that I am using as a chat client and within the main form is a subform that I have set as a continuous form. The user would enter text into a textbox and then click send, then the message entered is saved onto a table that is shown on the subform. Eventually when enough messages have been entered into the subform the user can use a scroll bar to scroll up and down to see previous messages. Everytime the subform refreshes, it goes right back up to the first record. I am trying to set the focus onto the last record when a user enters the chat client and when the subform has been refresh. I have tried everything I could think of nothing seems to work. I appreciate the help guys.

Thanks,
BananasInPajamas
 
I had to apply the code to the OnCurrent event in order to get it to work alright. Thanks a bunch!

So I have another question. I'm having trouble setting the caption of a label (lbltext). I want to set the caption of the label based off of a column (Message) from a tabel that I have set as a subform on a main form. Here is what I have.

lblMessage.caption = Message.Value
 
All names should be fully referenced (using Me for objects in the current class module). I have seen Access do weird stuff when the same control name is used on different forms without full references.

The subform SourceObject should be a form rather than directly to a table.
If the SourceObject is Table.tablename then you should create a form based on that table.

Then use:

Me.lblMessage.Caption = Me.subformcontrolname.Form.Message.Value

(The Value property is not really required as it is the default property of a control.)
 

Users who are viewing this thread

Back
Top Bottom