函数:Row和Rows的用法区别?

函数:Row和Rows的用法区别?前提刚刚敲代码时 出现了 30009 的错误 后来找出问题竟然发现只是少了一个 S 温习知识 Row 返回单元格或者区域所在的行号 Rows 返回区域的行数 即高度 有几行

大家好,欢迎来到IT知识分享网。

前提

刚刚敲代码时,出现了30009的错误,后来找出问题竟然发现只是少了一个S

温习知识

出现问题

在这里插入图片描述

解决方法

 If Not IsNumeric(Trim(txtcardno.Text)) Then MsgBox "请输入数字", 0 + 48, "提示" txtcardno.Text = "" txtcardno.SetFocus Exit Sub End If txtsql = "select * from line_info where cardno = '" & Trim(txtcardno.Text) & "'" Set mrc = ExecuteSQL(txtsql, msgtext) If mrc.EOF = True Then MsgBox "卡号不存在,请重新输入", 0 + 48, "提示" txtcardno.Text = "" txtcardno.SetFocus Exit Sub End If With myFlexGrid1 .Rows = 1 *'把Row改成Rows就行了* .CellAlignment = 4 .TextMatrix(0, 0) = "卡号" .TextMatrix(0, 1) = "姓名" .TextMatrix(0, 2) = "上机日期" .TextMatrix(0, 3) = "上机时间" .TextMatrix(0, 4) = "下机日期" .TextMatrix(0, 5) = "下机时间" .TextMatrix(0, 6) = "消费金额" .TextMatrix(0, 7) = "余额" .TextMatrix(0, 8) = "备注" Do While Not mrc.EOF .Rows = .Rows + 1 .CellAlignment = 4 .TextMatrix(.Rows - 1, 0) = mrc.Fields(1) .TextMatrix(.Rows - 1, 1) = mrc.Fields(3) .TextMatrix(.Rows - 1, 2) = mrc.Fields(6) .TextMatrix(.Rows - 1, 3) = mrc.Fields(7) .TextMatrix(.Rows - 1, 4) = mrc.Fields(8) & "" .TextMatrix(.Rows - 1, 5) = mrc.Fields(9) & "" .TextMatrix(.Rows - 1, 6) = mrc.Fields(11) & "" .TextMatrix(.Rows - 1, 7) = mrc.Fields(12) & "" .TextMatrix(.Rows - 1, 8) = mrc.Fields(13) & "" '移动到下一条记录 mrc.MoveNext Loop End With mrc.Close End Sub 

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://haidsoft.com/134845.html

(0)
上一篇 2025-07-09 13:10
下一篇 2025-07-09 13:15

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信