主题:msflexgrid的使用
Private Sub Command2_Click()
If Combo1.Text <> "" Then
Dim st As String
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
Set rs2 = New ADODB.Recordset
db.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=***/***;Extended Properties=DRIVER={Microsoft ODBC for Oracle};UID=***/***;SERVER=***;"
db.Open
rs.CursorLocation = adUseClient
rs1.CursorLocation = adUseClient
rs2.CursorLocation = adUseClient
rs.Open "select new_store_no,name from store_compare where name='" & Trim(Combo1.Text) & "'", db, adOpenStatic, adLockReadOnly
st = rs.Fields("new_store_no").Value
rs1.Open "select kfsh_id 活动号,kfsh_name 主题,kfsh_in 内容,kfsh_amnt 返券面值,kfsh_f_amnt1 第一档,kfsh_f_amnt2 第二档,kfsh_f_amnt3 第三档 from report.kfsh_name@store" & Trim(st) & " order by kfsh_id", db, adOpenStatic, adLockReadOnly
rs2.Open "select max(kfsh_id) id from report.kfsh_name@store" & Trim(st) & " where kfsh_id<800", db, adOpenStatic, adLockReadOnly
'msflexgrid1. = "当前最大活动号:" & rs2.Fields("id").Value
Set MSFlexGrid1.DataSource = rs1
Else
MsgBox "请选择操作门店", vbOKOnly, "返券设置"
End If
End Sub
报错对象变量或with块变量未设置,请哪位大虾指导下