-----Original Message-----
(1) You can put code in a Control's OnChange event to check the number of
characters that have been typed into that Control. Even easier may be to
capture Keystrokes on the Keypress event. If you've hit the limit of
characters for the Control, set the KeyASCII argument to 0 before exiting.
Without clarification, I can't answer the "different value at each record"
part. From where are you getting these different values?
(2) In Access, the term "current Record" as applied to Forms _means_
"selected Record", so I don't know how to answer this. Two, but not the only
two ways, to make a particular record current:
A. Create an SQL statement that will return only
the Record of interest, and use that SQL
statement to replace the Form's Record Source.
Particularly good when using an Access client
to a server database, or a split, multiuser
Access database in which the table is indexed
on the Field used as Criteria.
B. If you have the form opened on a RecordSource
that contains all the Records from which to select
one, and you know the Field that uniquely identifies
the Record you want, code similar to the following
(air code) may do what you want:
Me.RecordsetClone.FindFirst "[SubYourFieldHere] = " &
Me![SubControlContainingUniqueIDHere]
If Me.RecordsetClone.NoMatch = False Then
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
* that's for a UniqueID that is numeric (like an AutoNumber or Long Integer,
for example); if it is text use this for the FindFirst:
Me.RecordsetClone.FindFirst "[SubYourFieldHere] = """ &
Me![SubControlContainingUniqueIDHere] & """"
Good luck with your project.
Larry Linson
Microsoft Access MVP
Hi, it would be very helpful if you can assist me with
the following:
1. How can i limit the number of characters entered into
a text field in a form, according to a different value
at each record?
2. I have a form, records are presented as table. What is
the VBA code for selection of the current record? lets
say, if a press a button next to that specific record. by
default it always goes to the first one, i want it to
select the record which is next to the button.
.