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

Gustav Brock gustav at cactus.dk
Thu Apr 1 10:32:38 CST 2004


Hi Arthur

> Here is a function that I use for this purpose. It's specific to each
> particular field on a form, because in my experience I seldom wanted ALL
> the fields to be duplicated; but rather just many of them. Note that I
> typically define a compiler directive called TALKON.

> Public Function CarryForward()

>     Const cQuote = """"  'Thats two quotes
>     Dim ctlCurrent As Control
>     Set ctlCurrent = Screen.ActiveControl
>     ctlCurrent.DefaultValue = cQuote & ctlCurrent.Value & cQuote

In my experience this may fail in a non-US localized environment for
decimals and date/time values as .Value will be converted to a
localized string.

A typo here?

> #If TALKON = True Then
>     Debug.Print "Current default value: " & ctlCurrent.DefaultValue
>     Debug.Print "New default value: " & ctlCurrent.DefaultValue
> #End If

You are retrieving the same value twice ...

>     Set ctlCurrent = Nothing
    
> End Function

/gustav




More information about the AccessD mailing list