+ Reply to Thread
Results 1 to 5 of 5

Textbox3 should return negative values in database

  1. #1
    Registered User
    Join Date
    04-03-2014
    Location
    Islamabad, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    16

    Textbox3 should return negative values in database

    Hi all,
    I am new to VBA and learning form you all!
    i wanted to prepare voucher and wish that credit entry should be negative in textbox3 following what i did so far;
    Dim lngWriteRow As Long

    Dim ws As Worksheet
    Set ws = Worksheets("Sheet1")
    lngWriteRow = ws.Cells(Rows.Count, 2) _
    .End(xlUp).Offset(1, 0).Row
    ws.Range("B" & lngWriteRow) = TextBox1.Value
    ws.Range("C" & lngWriteRow) = TextBox2.Value
    ws.Range("D" & lngWriteRow) = TextBox3.Value*-1
    ws.Range("E" & lngWriteRow) = TextBox4.Value

    Me.TextBox1.Value = ""
    Me.TextBox2.Value = ""
    Me.TextBox3.Value = ""
    Me.TextBox4.Value = ""

    End Sub
    At first click it adds data correctly but if i click again on empty user-form it gives error....don't know how to deal with it...

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Textbox3 should return negative values in database

    Replace

    Please Login or Register  to view this content.
    With

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    04-03-2014
    Location
    Islamabad, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Textbox3 should return negative values in database

    Thanks it helps !
    Is it possible that text1 generates auto-numbers starting with 1000 and in text2 & text 3 only values can be entered?

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Textbox3 should return negative values in database

    Please start a new thread

  5. #5
    Registered User
    Join Date
    04-03-2014
    Location
    Islamabad, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: Textbox3 should return negative values in database

    OK let me start new one

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to return multiple values from a large database
    By kdelgreco2014 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-10-2014, 11:39 AM
  2. Problem with return values for a database where the column is called 'nominal'
    By herghost in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2012, 09:57 AM
  3. Find a value in a database for the most recent date, return all values relating to it.
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-22-2012, 01:39 PM
  4. [SOLVED] Won't accept textbox3
    By davegb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-09-2006, 12:30 PM
  5. [SOLVED] DCOUNT to Return Values from Access database
    By Tim H in forum Excel General
    Replies: 5
    Last Post: 12-15-2005, 07:30 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1