Hi guys,
I have a very simple form with 2 textboxes only and a listview to display added record. Upon form load i wanted to sest focus to textbox1, but it shows this error:
Run-time error 5:Invalid Procedure call or argument
My form load code
Private Sub Form_Load()
bModelMaster = False
Call GET_LV_MODEL_MASTER
Call cmdClear_Click
End Sub
Function GET_LV_MODEL_MASTER()
Me.lvwMasterModel.ListItems.Clear
Dim lItem As ListItem
Dim rs As New ADODB.Recordset
Dim sql As String
Call ConnectDB
sql = "Select * from MODEL_MASTER"
If search = True Then
sql = sql & " where PARTNUMBER like '%" & Me.txtPartNumber.Text & "%'"
End If
rs.Open sql, DB, adOpenStatic, adLockReadOnly
With rs
Do While Not .EOF
Set lItem = Me.lvwMasterModel.ListItems.Add
lItem.SubItems(1) = rs!model_name
lItem.SubItems(2) = rs!PartNumber
.MoveNext
Loop
End With
search = False
End Function
Private Sub cmdClear_Click()
Dim Ctl As Control
'Clear all the TextBoxes on the form
For Each Ctl In Controls
If TypeOf Ctl Is TextBox Then Ctl.Text = ""
Next Ctl
Me.txtPartNumber.SetFocus
End Sub
Please anyone help me. It's urgent :S