selecting contents of field so contents are replaced upon keystrokes

weeblebiker

Registered User.
Local time
Yesterday, 22:24
Joined
May 27, 2010
Messages
70
Hi,
I have a form and sub forms with a Serial Number field (unbound field, 1st tab order position) that is used as the look up for a query that fills in the form
the Serial Number field in "after update" event is set to do a requery macro
This is easy and works and fills in the rest of the form once a serial number is entered and tab or enter is hit.

I would really like the field to re select itself, select the contents so the field contents are replaced when the first key stroke of a new serial number is entered.

I Have
select:[Serial Number Field name]
in the lost focus event which puts the cursor at the beginning of the serial number in the serial Number Field when enter or tab is hit

how do I make the field contents highlighted (like when doubleclicking it) so the field is erased with the first keystroke?
maybe in the on focus event, but what is the sql code?
I tried
Me.[Serial #].SelLength = Len(Me.[Serial #])
which doens't work
 
found it!
simple
clear all events for the field and set the on lost focus event to requery macro.

this makes any form where you want the query select field to be on the form produced by the query super easy.

put an undefined field on the form.
set the initial select query for the form to look at that field.( used Forms!FormName!FieldName in the select query that the summery query uses tha populates the form) set the field event on lost focus to requery

it makes the form work like everyone wants a form to work. enter your search criteria into a field on the form and the other fields populate
 

Users who are viewing this thread

Back
Top Bottom