UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Ambiguous Name error    
 
   
Sonny
post Feb 7 2008, 05:08 PM
Post #1

New Member
Posts: 12



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
Go to the top of the page
 
+
niesz
post Feb 7 2008, 05:10 PM
Post #2

Utter A-fishin'-ado
Posts: 17,723
From: Cincinnati, Ohio, USA . . . ><((((°>



Yes. You can only have one OnCurrent event per form. Delete one of them or combine them into a single one.
Go to the top of the page
 
+
Sonny
post Feb 12 2008, 11:03 AM
Post #3

New Member
Posts: 12



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
Go to the top of the page
 
+
niesz
post Feb 12 2008, 11:22 AM
Post #4

Utter A-fishin'-ado
Posts: 17,723
From: Cincinnati, Ohio, USA . . . ><((((°>



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.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 21st May 2013 - 06:34 PM