(05/04/2020, 14:36)berduş yazdı: Belirttiğim gibi çalışmanızı eklerseniz uygun olduğumuzda inceleyip çözmeye çalışırız.
Hocam , ekledim..
Tekrar tekrar teşekkür ederim.
rs.Open "select * from m_siparis WHERE m_siparis.SIPEMRINO LIKE '" & TextBox1.Text & "%'", baglan, 1, 1
If .ListItems.Count < 1 Then
If Me.TextBox1.Value > "" Then
TBL_SIPRS.Tsipno.Value = Me.TextBox1.Value & "0000000001"
Else
TBL_SIPRS.Tsipno.Value = Empty
End If
GoTo son
End If
aa = .ListItems(.ListItems.Count)
For i = 1 To Len(aa)
If Not IsNumeric(Mid(aa, i, 1)) Then
bb = bb & Mid(aa, i, 1)
Else
say = i
Exit For
End If
Next
For ii = say To Len(aa)
If Mid(aa, ii, 1) = 0 Then
cc = cc & Mid(aa, ii, 1)
Else
sayy = ii
Exit For
End If
Next
dd = bb & cc
For iii = sayy To Len(aa)
ee = ee & Mid(aa, iii, 1)
Next
ff = dd & ee + 1
End With
TBL_SIPRS.Tsipno.Value = ff
Exit Sub
son:
Sub filtresprs()
Set baglan = CreateObject("adodb.connection")
Set rs = CreateObject("adodb.recordset")
baglan.Open "provider=microsoft.jet.oledb.4.0;data source=" & ThisWorkbook.Path & "\veritabani.mdb"
rs.Open "select * from m_siparis WHERE m_siparis.SIPEMRINO LIKE '" & TextBox1.Text & "%'", baglan, 1, 1
With ListView1
.ListItems.Clear
If rs.RecordCount > 0 Then
Do While Not rs.EOF
.ListItems.Add , , rs(0).Value & ""
For i = 1 To rs.Fields.Count - 1
.ListItems(.ListItems.Count).ListSubItems.Add , , rs(i).Value & ""
Next i
rs.MoveNext
Loop
End If
If .ListItems.Count < 1 Then
If Me.TextBox1.Value > "" Then
TBL_SIPRS.Tsipno.Value = Me.TextBox1.Value & "0000000001"
Else
TBL_SIPRS.Tsipno.Value = Empty
End If
GoTo son
End If
aa = .ListItems(.ListItems.Count)
For i = 1 To Len(aa)
If Not IsNumeric(Mid(aa, i, 1)) Then
bb = bb & Mid(aa, i, 1)
Else
say = i
Exit For
End If
Next
For ii = say To Len(aa)
If Mid(aa, ii, 1) = 0 Then
cc = cc & Mid(aa, ii, 1)
Else
sayy = ii
Exit For
End If
Next
dd = bb & cc
For iii = sayy To Len(aa)
ee = ee & Mid(aa, iii, 1)
Next
ff = dd & ee + 1
End With
TBL_SIPRS.Tsipno.Value = ff
Exit Sub
son:
Set rs = Nothing
Set con = Nothing
End Sub
Private Sub Tsipno_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
On Error Resume Next
Dim Hrf As String
Hrf = Chr(KeyAscii)
KeyAscii = 0
Set baglan = CreateObject("adodb.connection")
Set rs = CreateObject("adodb.recordset")
baglan.Open "provider=Microsoft.ACE.OLEDB.12.0;data source=" & ThisWorkbook.Path & "\veritabani.mdb"
SqlMax = "SELECT Max(Right(SiparisKayitlari.Siparis_No,11)) AS Sno FROM SiparisKayitlari WHERE (SiparisKayitlari.Siparis_No) Like '" & _
Hrf & "%'"
rs.Open SqlMax, baglan, adOpenKeyset, adLockPessimistic
rs.MoveFirst
gecici = IIf(IsNull(rs(0)), 1, rs(0) + 1)
Tsipno = Hrf & Format(gecici, "00000000000")
rs.Close
End Sub
Not:baglan.Open "provider=Microsoft.ACE.OLEDB.12.0;data source=" & ThisWorkbook.Path & "\veritabani.mdb" bu koddaki