Hi friends,

I have a form with 8 textfields. Textfield1 is combo box. Thus, when user chooses an item, Textfield2 and Textfield3 automatically retrieve value from DB and fill in the textfields (in lostfocus event). Then, user will add running number behind Textfield3. After that, fill in the rest of the fields. The last field is address, where user clicks a 'To' button and select from list view. Here, once the user clicks the 'To' button, Textfield3 resume back to data retrieved from DB where the running number disappears. I know it's because of the lostfocus event I have for Textfield1.

But, how do i prevent running number from missing? How to stop the lostfocus event once Textfield2 and Textfield3 are filled.

Please help me with this problem. Thanks in advance.

The lostfocus event code:

Private Sub cbMN_LostFocus()
Dim strExtract As String
 For i = 1 To Len(cbMN.Text)
 If Mid(cbMN.Text, i, 1) = "-" Then
 strExtract = strExtract & Mid(cbMN.Text, i, 1)
 End If
 If format(Date, "ww") = 53 Then
 Me.txtBoxID.Text = strExtract & format(Date, "yy") + 1 & "01"
    Me.txtBoxID.Text = strExtract & format(Date, "yy")
    If Len(format(Date, "ww")) < 2 Then
    Me.txtBoxID.Text = Me.txtBoxID.Text & 0 & format(Date, "ww")
    Me.txtBoxID.Text = Me.txtBoxID.Text & format(Date, "ww")
    End If
 End If
End Sub

Okay, I think you should look at your click event of that button before you go adding if text2.text<>"" and text3.text<>"" then leave text4 alone because it sounds like your problem is in there...

Good Luck