slamet Harto
09-16-2009, 12:52 PM
Hi guys,
I'm using MSFlexGrid to create column header in a userform, but I have an error message "Invalid or Unqulified Reference" for this line .MoveNext :banghead:
Here is a part of my VBA
Dim x as integer
sSQL = "SELECT * FROM TbVouch WHERE rtrim(TbVouch.ReqID)='" & Me.txtUser.Text & "' and tbvouch.VocStat ='uncompleted' Or tbvouch.Status ='0';"
Set rst = Cn.Execute(sSQL)
If Not rst.BOF And Not rst.EOF Then
Do While Not rst.EOF
On Error Resume Next
MSFlexGrid1.TextMatrix(x, 0) = "No"
MSFlexGrid1.TextMatrix(x, 1) = "VoucherRegNo"
MSFlexGrid1.TextMatrix(x, 2) = "CompNm"
MSFlexGrid1.TextMatrix(x, 3) = "Route"
MSFlexGrid1.TextMatrix(x, 4) = "Amount
MSFlexGrid1.TextMatrix(x, 5) = "Qty
MSFlexGrid1.TextMatrix(x, 7) = "In - Out"
.MoveNext
x = x + 1
MSFlexGrid1.Rows = x + 1
Loop
Else
MsgBox "Record Not Found!", vbInformation, "Information"
End If
On Ms Access table with FieldName and Data Type are:
No AutoNumber
VoucherRegNo Text
CompNm Text
Route Text
Qty Number
In - Out Text
Please help and thank you! :help
I'm using MSFlexGrid to create column header in a userform, but I have an error message "Invalid or Unqulified Reference" for this line .MoveNext :banghead:
Here is a part of my VBA
Dim x as integer
sSQL = "SELECT * FROM TbVouch WHERE rtrim(TbVouch.ReqID)='" & Me.txtUser.Text & "' and tbvouch.VocStat ='uncompleted' Or tbvouch.Status ='0';"
Set rst = Cn.Execute(sSQL)
If Not rst.BOF And Not rst.EOF Then
Do While Not rst.EOF
On Error Resume Next
MSFlexGrid1.TextMatrix(x, 0) = "No"
MSFlexGrid1.TextMatrix(x, 1) = "VoucherRegNo"
MSFlexGrid1.TextMatrix(x, 2) = "CompNm"
MSFlexGrid1.TextMatrix(x, 3) = "Route"
MSFlexGrid1.TextMatrix(x, 4) = "Amount
MSFlexGrid1.TextMatrix(x, 5) = "Qty
MSFlexGrid1.TextMatrix(x, 7) = "In - Out"
.MoveNext
x = x + 1
MSFlexGrid1.Rows = x + 1
Loop
Else
MsgBox "Record Not Found!", vbInformation, "Information"
End If
On Ms Access table with FieldName and Data Type are:
No AutoNumber
VoucherRegNo Text
CompNm Text
Route Text
Qty Number
In - Out Text
Please help and thank you! :help