1 Replies - 361 Views - Last Post: 29 November 2016 - 01:41 PM

#1 arogers  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 06-September 07

compare 4th, 5th, and 6th characters from an input of a textbox

Posted 29 November 2016 - 01:35 PM

I have a database in place that an inspector inputs the 11 character serial number for the unit that is being looked at.
what I am trying to do is in the after update event field I am trying to compare the 4th, 5th, and 6th characters to look for a specific character combo. then using an if then structure have it automatically input a number the correct textbox so that when the next entry button is clicked it gets stored in the table and can later be called from the report I have already set up.

here's the code I have so far
Private Sub Serial_Number_AfterUpdate()
 If Value = CNHB18 Then
    B18_EU = 1
 ElseIf Value = CNHC22 Then
    Case_22 = 1
 ElseIf Value = CNHC20 Then
    Case_20 = 1
 ElseIf Value = CNHN22 Then
    NH_20 = 1
 ElseIf Value = CNHN20 Then
    NH_22 = 1
 Else
     Value = 0
 End If
End Sub


my question is how best to look at those specific characters using vba. Should it be an array where every character is read in and then compared to a default, or is there a built in character review function? been looking online and none of the tutorials even offer a hint as to where to proceed next.

any help would be appreciated.
thnxs

Is This A Good Question/Topic? 0
  • +

Replies To: compare 4th, 5th, and 6th characters from an input of a textbox

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13552
  • View blog
  • Posts: 54,075
  • Joined: 12-June 08

Re: compare 4th, 5th, and 6th characters from an input of a textbox

Posted 29 November 2016 - 01:41 PM

Strings are arrays. You should be able to directly access specific index points using ( ).
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1