Results 1 to 4 of 4

Thread: adding number with string

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    adding number with string

    im adding an applicant number like this APP-0001 what will i do to automaically add like that
    VB Code:
    1. With tbInquiry
    2.       If .RecordCount = 0 Then
    3.         txtAppID = "00000001"
    4.  
    5.     Else
    6.         .MoveLast
    7.         txtAppID = .Fields(0) + 1
    8. '        txtAppInfo(0).SetFocus
    9.     End If
    10. End With
    11. End Sub

  2. #2
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: adding number with string

    eh a little more info are you using a listbox ?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: adding number with string

    no i dont

  4. #4
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: adding number with string

    what is the database value that you are having...if it is "00000001" then try this
    VB Code:
    1. With tbInquiry
    2.       If .RecordCount = 0 Then
    3.           txtAppID.Text = "00000001"
    4.       Else
    5.           .MoveLast
    6.           txtAppID.Text = "APP-" & Format(Val(.Fields(0) & "") + 1,"0000")
    7.       End If
    8. End With
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


Posting Permissions

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



Click Here to Expand Forum to Full Width