Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists("\pic\" + Me.学号.Value + ".jpg") Then
Me.照片.Picture = "\pic\" + Me.学号.Value + ".jpg"
Else
Me.照片.Picture = "\pic\cat.jpg"
End If
无论我将pic前面的"\"去掉与否,都找不到这个相对路径,如果我用绝对路径就能找到,请各位大虾指出错误,偶是新手阿,谢谢!作者: lanchong 时间: 2006-9-7 20:50
dim strpath as string
strpath=CurrentProject.path
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(strpath+"\"+ Me.学号.Value + ".jpg") Then
Me.照片.Picture = strpath +"\"+ Me.学号.Value + ".jpg"
Else
Me.照片.Picture =strpath &"\cat.jpg"
End If作者: lanchong 时间: 2006-9-7 20:54
或者。\pic\
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(".\pic\" + Me.学号.Value + ".jpg") Then
Me.照片.Picture = ".\pic\" + Me.学号.Value + ".jpg"
Else
Me.照片.Picture = ".\pic\cat.jpg"
End If作者: huoran 时间: 2006-9-7 21:19
十分感谢!问题解决作者: wxf2008hz 时间: 2009-8-19 07:48
bucuo作者: apsfxc1 时间: 2009-8-19 10:00
学习..