我是个新手,这两天做了个通讯录,照着本站的新书《Access数据库系统开发从础到实践》的一段代码想做一个照片输入,可是老出错,现在把MDB文件附上,请高手看一下指点指点,我看了两天都不明白。
代码如下
Private Function getfilename() As String
'引用microsoft office 10/11 object library
'获取bmp/jpg图片文件的路径
Dim result As Integer
With Application.FileDialog(msoFileDialogFilePicker)
.Title = "请选择联系人的照片"
.Filters.Add "JPEGs", "*.jpg"
.Filters.Add "位图文件", "*.bmp"
.FilterIndex = 2
.AllowMultiSelect = False
result = .Show
If (result <> 0) Then
getfilename = Trim(.SelectedItems.Item(1))
End If
End With
End Function
Private Sub 添加照片_click()
Dim strpicpath As String
strpicpath = getfilename()
If strpicpath <> "" Then
FEmpPhoto.SourceDoc = strpicpath
FEmpPhoto.Action = acOLECreateEmbed
End If
End Sub
Private Sub 删除照片_click()
FEmpPhoto.Value = ""
End Sub
[此贴子已经被作者于2006-4-13 18:24:36编辑过]
|