[AccessD] Add new record + fill fields with last entered data?

Gustav Brock gustav at cactus.dk
Thu Apr 1 07:29:57 CST 2004


Hi Tina

> How does one set the DefautlValue at OnCurrent?  I don't know how to do
> that.

That's not difficult - something like this:

  Dim txt As TextBox
  Set txt = Me!txtYourTextBox

  txt.DefaultValue = txt.Value

  Set txt = Nothing

However, DefaultValue should be a string which means that if your
textbox contains decimals or a date/time value you must be careful and
convert to a string in US format:

  txt.DefaultValue = LTrim(Str(txt.Value))

or

  txt.DefaultValue = _
    Format(txt.Value, "\#mm\/dd\/yyyy hh\:nn\:ss AM/PM\#")

/gustav


>>Tough day? No coffee?
>>
>>Set the DefaultValue at OnCurrent.
>>
>>As for Stuart's note on the KeyPreview, it's not a user feature, but a
>>property of the form.
>>
>>/gustav

>>>when a user clicks the 'Add new record' button (s)he wants the data of the current record to be displayed in the new record.
>>>So if a user is on record 999 with field username filled with AAA and then clicks on 'Add new record' then a new record (1000) must appear with the field username filled with AAA.




More information about the AccessD mailing list