hi all,
please help me ti solved the problem,

my syntax

Public Sub GenerateNota()
Dim counter As Integer
Dim a As Integer
Dim SQLTEKS As String
SQLTEKS = DMPOS.TSetting.CommandText
DMPOS.MSConnection.Close()
DMPOS.MSConnection.Open()
DMPOS.TSetting.Parameters.Clear()
DMPOS.TSetting.Connection = DMPOS.MSConnection
DMPOS.TSetting.CommandText = SQLTEKS
DMPOS.TSetting.ExecuteNonQuery()
a = Int(DMPOS.TSetting.ExecuteReader("No"))
With DMPOS
.MSConnection.Close()
.AdoQuery1.CommandText = ""
If UUtama.transfer_data Then
.AdoQuery1.CommandText("select MAX(CONVERT(INT,SUBSTRING( '" & NamaField & "' ,4,5))) as KODE from '" & NamaTable & "' where LEFT('" & NamaField & "',3)= '" & UUtama.NumToStr(a, 3) & "' ")
Else
'.AdoQuery1.CommandText("select MAX('" & NamaField & "') as KODE from '" & NamaTable & "' where '" & NamaField & "' <> '" - "' ")
End If
.MSConnection.Close()
Dim data = .AdoQuery1.ExecuteReader
If Str(data("KODE")) = "" Then
counter = 1
Else : counter = Int(data("KODE").Value) + 1
End If
If UUtama.transfer_data Then
EKode.Text = UUtama.NumToStr(a, 3) & UUtama.NumToStr(counter, 5)
Else : EKode.Text = UUtama.NumToStr(counter, 5)
End If
End With
End Sub

why this syntax error
.AdoQuery1.CommandText("select MAX(CONVERT(INT,SUBSTRING( '" & NamaField & "' ,4,5))) as KODE from '" & NamaTable & "' where LEFT('" & NamaField & "',3)= '" & UUtama.NumToStr(a, 3) & "' ")

the error display is "property access must assign to the property or use its value"

Help me...