Results 1 to 3 of 3

Thread: Database

  1. #1
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Database

    Private Sub Setup_Click()

    Unload Me
    Application.ScreenUpdating = False

    Sheets("controls").Select
    Range("Q193").Select

    ActiveCell.Offset(0, 2).Value = Val(Location_Name)
    ActiveCell.Offset(1, 2).Value = Val(City_Name)
    ActiveCell.Offset(2, 2).Value = Val(State_Name)
    ActiveCell.Offset(3, 2).Value = Val(ZipCode_Name)
    ActiveCell.Offset(5, 2).Value = Val(FourCode)
    ActiveCell.Offset(6, 2).Value = Val(TwoCode)
    ActiveCell.Offset(4, 2).Value = Val(GMName)
    ActiveCell.Offset(11, 2).Value = Val(Salary)
    ActiveCell.Offset(12, 2).Value = Val(PayrollTax)
    ActiveCell.Offset(13, 2).Value = Val(FedUmTax)
    ActiveCell.Offset(14, 2).Value = Val(StateUnTax)

    This is just a sample of the code that runs when the user clicks [Finished] on the userform. The problem is: anywhere a number is entered, it copies to the db flawlessly. But when text is entered, like City_Name, it only places a zero(0) in the db. Why want the text copy to the db? I know I'm leaving out something simple! Help Please
    - Ricky

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Database

    That is what the Val function does. It converts the numeric part of a string to a number and ignores the non-numeric characters. If there are no numeric characters, it returns zero. Remove the Val from the text values.
    Legare Coleman

  3. #3
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Database

    Legare, Thank you - I've got it functioning properly now.
    - Ricky

Posting Permissions

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