Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Apr 2005
    Location
    Plovdiv
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Copy Data in the form (Access 2000)

    How could i transferr the data from one control of the form into another control of the form and add a 0 after the figure? I want to avoid writing one and the same figure two times.It should be enough if i write the figure in the first control, i.e. Fulstat and in the AfterUpdate event the figure to be copied into the field taxid.For example, the data from Me!Fulstat to be transferred to me!TaxID and after the figure say 831132997 to add a 0 and become 8311329970.The figures for the Fulstat are fixed and must always be 9, while the figures in the taxid should be 9 plus 0, or total 10.The above action should be carried out for each new customer and not for the old customers.
    Thank you in advance for the help i will receive

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Copy Data in the form (Access 2000)

    SinceTaxID is a calculated value, you don't need a TaxID field in the table. You can calculate it in a query based on the table, or in a form.

    In a query, you would create a column
    <code>
    TaxID: [Fulstat] & "0"
    </code>
    if Fulstat is a text field, or
    <code>
    TaxID: [Fulstat]*10
    </code>
    if Fulstat is a number field.
    You can use the query as record source for forms and reports. If you don't want to create a query, you can set the Control Source of the TaxID text box on a form or report to
    <code>
    =[Fulstat] & "0"
    </code>
    if Fulstat is a text field, or
    <code>
    =[Fulstat]*10
    </code>
    if Fulstat is numeric.

  3. #3
    2 Star Lounger
    Join Date
    Apr 2005
    Location
    Plovdiv
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy Data in the form (Access 2000)

    Thank you for your reply.I need to give you the background of my question.Our accountant has asked us to preserve the control taxid but to hide it, because she needs it for the previous operations.For any new records she asks that
    the data from the Fulstat be copied to taxid.Therefore i must not change the present data, only when a new customwr is needed, then the taxid should be populated from the Fulstat.I have tried to do it under the control new client in the attachment i am sending, but the control taxis is not populated.Obvisoulsy i have not understood something.Will you have a look ?

    regards

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Copy Data in the form (Access 2000)

    I'm afraid that your code makes little sense. When you move to a new record, Fulstat has not been entered yet by the user, so you cannot fill TaxID yet. You must do that when the record is saved, in the Before Update event of the form. You can test whether you are dealing with a new record by inspecting the NewRecord property of the form. For example:

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    If Me.NewRecord Then
    If IsNull(Me.Fulstat) Then
    MsgBox "Please enter Fulstat!", vbExclamation
    Me.Fulstat.SetFocus
    Cancel = True
    Else
    Me.TaxID = Me.Fulstat & "0"
    End If
    End If
    End Sub

  5. #5
    2 Star Lounger
    Join Date
    Apr 2005
    Location
    Plovdiv
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy Data in the form (Access 2000)

    Thanks Hans

Posting Permissions

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