Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2002
    Posts
    68

    Question Unanswered: 2 More Microsoft Access Questions

    hi all,

    1) I have an Microsoft Access Form. I am wondering once a date is entered, how to keep that date the same until it is changed by the user?


    2) I have a user enter a label tag number and have ADA- inputted after the form is saved. But if I go back into the form it will add ADA- again (Example: tag#: 1234 after I save the form it will be ADA-1234. If I go back and update the file it will now save as ADA-ADA-1234) How do I stop this. My BeforeUpdate Statement Code is listed below, So How would I write a AfterUpdate statement to show that IF there is already a ADA-, do not rerun the BeforeUpdate statement?

    Private Sub Form_BeforeUpdate(Cancel As Integer)

    Me.Label_TAG.SetFocus

    If Left(Label_TAG.Value, 4) <> "ADA-" Then
    Label_TAG.Value = "ADA-" & Label_TAG.Value
    End If
    End Sub



    Thanks,
    John316

  2. #2
    Join Date
    Mar 2002
    Location
    Sacramento, CA
    Posts
    120

    I'll try again!!

    1) Is your form bound to a table or query?
    The field must be bound to a ControlSource (a property
    of the TextBox). This way the date is stored. Otherwise, if the textbox
    is not bound as a ControlSource, how would Access know to "remember it" ?

    2) Put the code in the After_Update Event.
    Get rid of the Set.focus line

    Michael
    Last edited by mrabrams; 09-18-02 at 11:56.

  3. #3
    Join Date
    Sep 2002
    Posts
    68

    Re: I'll try again!!

    My From is bound by a table. And I am not understanding what you mean by you afterupdate event statement

    John316


    Originally posted by mrabrams
    1) Is your form bound to a table or query?
    The field must be bound to a ControlSource (a property
    of the TextBox). This way the date is stored. Otherwise, if the textbox
    is not bound as a ControlSource, how would Access know to "remember it" ?

    2) Put the code in the After_Update Event.
    Get rid of the Set.focus line

    Michael

  4. #4
    Join Date
    Mar 2002
    Location
    Sacramento, CA
    Posts
    120

    Sorry

    Take your code out of the Before_Update event.
    Place the following in the After_Update Event:

    If Left(Label_TAG.Value, 4) <> "ADA-" Then
    Label_TAG.Value = "ADA-" & Label_TAG.Value
    End If

    I tried it and it works fine.

    Good Luck !

    Michael

  5. #5
    Join Date
    Sep 2002
    Posts
    68

    Re: THANKS IT WORKED

    THANKS it worked

    Originally posted by mrabrams
    Take your code out of the Before_Update event.
    Place the following in the After_Update Event:

    If Left(Label_TAG.Value, 4) <> "ADA-" Then
    Label_TAG.Value = "ADA-" & Label_TAG.Value
    End If

    I tried it and it works fine.

    Good Luck !

    Michael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •