存储特定记录的图像路径不是所有记录?

时间:2014-01-09 11:21:44

标签: ms-access-2010

我有这个代码

Private Sub cmdBrowse_Click()
Dim FileOpenDialog As FileDialog
Set FileOpenDialog = Application.FileDialog(msoFileDialogFilePicker)
Dim SelectedFile As Variant
Dim db As DAO.Database
Set db = CurrentDb
With FileOpenDialog
    .AllowMultiSelect = False
    .Title = "Select A File To Use As A Logo"
    .Filters.Clear
    .Filters.Add "Images", "*.gif; *.jpg; *.jpeg;*.bmp;*.png"
    .ButtonName = "Use This File"
   If .Show = True Then
      For Each SelectedFile In .SelectedItems
        Dim LogoFile As String
        LogoFile = SelectedFile
        Dim barewabarayate As Recordset
        Set barewabarayate = db.OpenRecordset("barewabarayate")
        With barewabarayate
            .Edit
            barewabarayate.Fields("image_path") = LogoFile
            barewabarayate.Update
          End With
        Next
    End If
    End With
End Sub

当我单击cmdbrowse按钮打开图像时,它成功运行并在我的图像控件中显示所选图像,它还将图像路径存储在我的表格字段中...我的问题是当我点击表单上的下一个按钮更改记录时它显示我的表中的每个记录的图像我希望我的代码存储图像路径只有一个记录而不是所有记录?

0 个答案:

没有答案