hello everyone this is my first post ...
i am having an errors in the code ..:
first error is : Private Sub txt_GotFocus(Index As Integer)
SendKeys "{end}+{home}"
End Sub
second error is:
Private Sub cmdOK_Click()
If supplierflag = 1 Then
frmMMSSupplier.txt(0) = lv.ListItems(lv.SelectedItem.Index).SubItems(1)
'frmMMSSupplier.txt(0).SetFocus
Unload Me
End If
End Sub
third error is in the same form .. anyway i will post the hall script...
those errors are in the suppliers form...
thanks for help ... My Best Regards
i am having an errors in the code ..:
first error is : Private Sub txt_GotFocus(Index As Integer)
SendKeys "{end}+{home}"
End Sub
second error is:
Private Sub cmdOK_Click()
If supplierflag = 1 Then
frmMMSSupplier.txt(0) = lv.ListItems(lv.SelectedItem.Index).SubItems(1)
'frmMMSSupplier.txt(0).SetFocus
Unload Me
End If
End Sub
third error is in the same form .. anyway i will post the hall script...
those errors are in the suppliers form...
Code:
Private Sub cmdedit_Click()
Call txt_unlock
cmdLookup.Enabled = True
cmdSave.Enabled = True
cmdSave.Caption = "Fresko"
cmdEdit.Enabled = False
cmdNew.Enabled = False
Command2.Enabled = True
txt(0).SetFocus
End Sub
Private Sub cmdlookup_Click()
supplierflag = 1
txt(0).SetFocus
LoadForm SupplierSearch
End Sub
Private Sub cmdnew_Click()
Call new_supplierid
Call txt_unlock
txt(0).Locked = True
cmdNew.Enabled = False
cmdEdit.Enabled = False
cmdSave.Enabled = True
Command2.Enabled = True
txt(1).SetFocus
End Sub
Private Sub cmdsave_Click()
Select Case cmdSave.Caption
Case "Ruaje"
Call dbconek
With ar
.Open "Select *From tblFurnizuesit", strConek, adOpenStatic, adLockOptimistic
.AddNew
!fur_id = txt(0)
!furnizuesi = txt(1)
!personi = txt(2)
!adresa = txt(3)
!numri = txt(4)
.Update
MsgBox "Furnizuesi u ruajt me sukses.", vbInformation, "Ruajtja!"
Call Command2_Click
.Close
End With
Case "Fresko"
Call dbconek
With ar
criteria = "Select *From tblFurnizuesit Where fur_id='" & txt(0) & "'"
.Open criteria, strConek, adOpenStatic, adLockOptimistic
!fur_id = txt(0)
!furnizuesi = txt(1)
!personi = txt(2)
!adresa = txt(3)
!numri = txt(4)
.Update
MsgBox "Furnizuesi u ruajt me sukses.", vbInformation, "Ruajtja!"
Call Command2_Click
.Close
End With
End Select
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
LoadForm frmMMSSupplier
End Sub
Private Sub new_supplierid()
On Error Resume Next
Call dbconek
Dim lastid As String
With ar
criteria = "Select *From tblFurnizuesit"
.Open criteria, strConek, adOpenStatic, adLockOptimistic
.MoveLast
lastid = Mid(!fur_id, 5, Len(!fur_id))
lastid = Val(lastid) + 1
If Len(lastid) = 1 Then
txt(0) = "FUR-" & "00" & lastid
ElseIf Len(lastid) = 2 Then
txt(0) = "FUR-" & "0" & lastid
ElseIf Len(lastid) = 3 Then
txt(0) = "FUR-" & lastid
End If
.Close
End With
End Sub
Private Sub txt_unlock()
Dim I As Integer
For I = 0 To 4
txt(I).Locked = False
Next
End Sub
Private Sub clear_txt()
Dim I As Integer
For I = 0 To 4
txt(I) = ""
Next
End Sub
Private Sub txt_KeyPress(Index As Integer, KeyAscii As Integer)
Select Case Index
Case 0
If KeyAscii = 13 Then
Call dbconek
With ar
criteria = "Select *From tblFurnizuesit Where fur_id='" & txt(0) & "'"
.Open criteria, strConek, adOpenStatic, adLockOptimistic
If .RecordCount = 1 Then
txt(1) = !furnizuesi
txt(2) = !personi
txt(3) = !adresa
txt(4) = !numri
Else
MsgBox "Furnizuesi nuk ekziston.", vbInformation, "Gabim!"
Exit Sub
End If
.Close
End With
End If
KeyAscii = Asc(UCase(Chr(KeyAscii)))
Case 1
KeyAscii = Asc(UCase(Chr(KeyAscii)))
Case 2
KeyAscii = Asc(UCase(Chr(KeyAscii)))
Case 3
KeyAscii = Asc(UCase(Chr(KeyAscii)))
Case 4
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Select
End Sub
thanks for help ... My Best Regards