form上放一个picture控件.双击form,写上如下代码:Dim iRe As ADODB.Recordset '定义共同变量Private Sub Form_Load() 'form调用时打开记录集,并设置绑定 Set iRe = New ADODB.Recordset With iRe .Open "tb_img", "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=F:\My Documents\客户资料1.mdb" '打开记录集 Set Picture1.DataSource = iRe '设置绑定 Picture1.DataField = "img" '图片字段 End With End SubPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) '关闭form时 iRe.Close '关闭记录集 Set iRe = Nothing End Sub
form上放一个picture控件.双击form,写上如下代码:Dim iRe As ADODB.Recordset '定义共同变量Private Sub Form_Load() 'form调用时打开记录集,并设置绑定
Set iRe = New ADODB.Recordset
With iRe
.Open "tb_img", "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=F:\My Documents\客户资料1.mdb" '打开记录集
Set Picture1.DataSource = iRe '设置绑定
Picture1.DataField = "img" '图片字段
End With
End SubPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) '关闭form时
iRe.Close '关闭记录集
Set iRe = Nothing
End Sub