Full Version: Ambiguous Name error
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
Sonny
I have a table for complaints, and a form to add data. One of the needs that I have is to track photos that show the nature of the complaint. That is, as I browse the records, I have a photo that should show for each record.

I have the following code entered for the form, but I get an error. The error was:

“The expression On Current you entered as the event property setting produced the following error: Ambiguous name detected: Form_Current.”

After looking at the code I noticed that I have a duplicate use of the Form_Current, and I am wondering if that might be the problem.
See below:

Private Sub Form_Current()
If Len(CStr(Nz(Me.PhPath, "")) & CStr(Nz(Me.PhFile, ""))) > 0 Then
Me.Image38.Picture = CStr(Me.PhPath) & CStr(Me.PhFile)
Else
Me.Image38.Picture = ""
End If
End Sub

Private Sub Form_Current()
'If this is a new record then fire the
'SetComplaintField function.
If Me.NewRecord = True Then
Call SetComplaintField
'Set Focus onto the Project Date TextBox
'when going into a new Record.
Me.ComplaintDate.SetFocus
End If
End Sub


Thanks

Sonny
niesz
Yes. You can only have one OnCurrent event per form. Delete one of them or combine them into a single one.
Sonny
Thanks for the response. I would like to keep the current code, but change it to work. That is I don't want to delete anything. Any suggestion on how to implement a change that would allow me to do that? One other thnig, when I have the form in the design mode, and right-click on the photo and choose properties, I attempt to set the "Picture" property to C:\Photos\" ", but when I open it again it shows "C:\Photos\2008.jpg" which is the first photo that I tried to link to.

by the way, if I wanted to show the screenshot of what I am talking about, how would I do that?


Thanks
Sonny
niesz
To combine them, just move the code from one to the other and delete the empty OnCurrent routine:

Private Sub Form_Current()

If Len(CStr(Nz(Me.PhPath, "")) & CStr(Nz(Me.PhFile, ""))) > 0 Then
Me.Image38.Picture = CStr(Me.PhPath) & CStr(Me.PhFile)
Else
Me.Image38.Picture = ""
End If

'If this is a new record then fire the
'SetComplaintField function.
If Me.NewRecord = True Then
Call SetComplaintField
'Set Focus onto the Project Date TextBox
'when going into a new Record.
Me.ComplaintDate.SetFocus
End If

End Sub

Pictures can be attached by creating a small JPG and attaching to the post. Or you can paste the screenshot into Word, zip the DOC file , and attach it.

You cannot set a Picture path to a non-existant picture.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.