主窗体代码:
Private Sub Command39_Click()
Me.Text32.Value = Me.Text1.Form.照片编号
Form_Current
End Sub
Private Sub Form_Current()
If Dir(CurrentProject.Path & "\photo\" & Me.Text32 & ".jpg") = "" Then
Image12.Picture = CurrentProject.Path & "\" & "err.jpg"
Else
Image12.Picture = CurrentProject.Path & "\photo\" & Me.Text32 & ".jpg"
End If
End Sub
只有按command39,照片才能显示,我想点击子窗体的记录,直接就能显示照片,请问代码怎么加呀
子窗体代码:
Private Sub 照片编号_Click()
Me.Parent.Text32 = Me.照片编号
End Sub
[attach]49338[/attach]作者: 13601812106_01 时间: 2012-6-12 13:58
Private Sub 代码_DblClick(Cancel As Integer)
Shell "rundll32.exe shimgvw.dll,imageview_fullscreen " & Me.照片图像.Picture ' 调用 windows 图片和传真查看器打开图片
End Sub
Private Sub Form_Current() '切换记录时会触发成为当前事件
Dim 路径名 As String
Dim Y As String
Private Sub 照片编号_Click()
dim Frm as form
dim StrPIC as string
set frm=Me.Parent
strpic =nz( Me.照片编号,"")
frm.Text32 = strpic
If Dir(CurrentProject.Path & "\photo\" & strpic & ".jpg") = "" Then
frm.Image12.Picture = CurrentProject.Path & "\" & "err.jpg"
Else
frm.Image12.Picture = CurrentProject.Path & "\photo\" & strpic & ".jpg"
End If
End Sub 作者: mmteaa 时间: 2012-6-12 16:23
多谢楼上二位,搞定了,下面是浪淘沙给的代码:
把主子窗体代码都删除,子窗体加如下代码
Private Sub Form_Current()
If Dir(CurrentProject.Path & "\photo\" & Me.照片编号 & ".jpg") = "" Then
me.parent.form.Image12.Picture = CurrentProject.Path & "\" & "err.jpg"
Else
me.parent.form.Image12.Picture = CurrentProject.Path & "\photo\" & Me.照片编号 & ".jpg"
End If
End Sub