I wish to populate 2 text fields with information taken from a string.
I have used the VB Right method to look at he last 5 characters within the string (MSN field taken from qrywarrants), depending on the last 5 characters, this should populate the text fields of txtAccountNo and txtAccountyType on the fromwarrants form.
The routine is held on the open command of form frmwarrants.
For some reason it just wont do it, it only adds something on the first line, any help would be helpful.
I have attached the database in question, plus the code is below.
Private Sub Form_Open(Cancel As Integer)
'Set account type and account no
Dim accountno As Integer
accountno = Right([msn], 5)
DoCmd.Maximize
Forms!frmwarrant.RecordSource = "SELECT * From qrywarrant order by [warrantstart], [expr1], [issue created]"
txtwarrantno.SetFocus
If accountno = 10615 Then
txtAccountNo = 9300
txtAccountType = "Civilian"
End If
If accountno = 10507 Then
txtAccountNo = 9400
txtAccountType = "Civilian PE"
End If
If accountno = 10616 Then
txtAccountNo = 9700
txtAccountType = "Navy"
End If
If accountno = 10617 Then
txtAccountNo = 9800
txtAccountType = "Army"
End If
If accountno = 10618 Then
txtAccountNo = 9900
ttxtAccountType = "RAF"
End If
End Sub