Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compile error: Ambiguous name detected: IsLoaded

Status
Not open for further replies.

Creeker

MIS
Apr 22, 2002
107
US
Can anyone tell me by looking at this code what is wrong with it? I know nothing about coding. I get this error when attempting to open this form to add a spouse to a registrants record from the form "frmMeetingRegistrantsInfo" or "frmMeetingExhibitorsInfo". Then the database freezes up and I have to close and re-open.


Private Sub Form_Load()

' Enable controls only when form is opened from the
' frmMeetingRegistrantsInfo

If IsLoaded("frmMeetingRegistrants") Or ("frmMeetingExhibitors") Then
'EnableControls Me, acDetail, True
Me!SpouseName.Enabled = True
Me!SpouseName = Me.OpenArgs
Me!SpouseName.SetFocus
Else
'EnableControls Me, acDetail, False
Me!SpouseName.Enabled = False


End If


End Sub



I'd welcome any suggestions.
 
I think you need to use IsLoaded twice, like this:

Code:
 If IsLoaded("frmMeetingRegistrants") Or _ 
    IsLoaded("frmMeetingExhibitors") Then
etc

As you have written the line, I think Access will try to perform a Boolean 'or' operation on the two forms or form names ... I'm sure that's why it locks up!


Bob Stubbs
 
Bob,

Tried that and it didn't work. Actually, I think I failed to paste in the entire code. It looks like this:
-----------

Option Compare Database
Option Explicit

Private Sub Command18_Click()
On Error GoTo Err_Command18_Click


DoCmd.Close

Exit_Command18_Click:
Exit Sub

Err_Command18_Click:
MsgBox Err.Description
Resume Exit_Command18_Click

End Sub

Private Sub Form_Current()


If IsLoaded("frmMain") And (Forms![frmMain]![frmRegistrantsExhibitors] = "1") Then
Me!PerID = Forms![frmMeetingRegistrants]![Child11].Form.PerID
Else
Me!PerID = Forms![frmMeetingExhibitors]![Child11].Form.PerID
End If
'DoCmd.RunMacro "Message"
'Me!SpouseName = Forms![frmMeetingRegistrants]![Child11].Form.SpouseName

End Sub

Private Sub Form_Load()

' Enable controls only when form is opened from the
' frmMeetingRegistrantsInfo

If IsLoaded("frmMeetingRegistrantsInfo") Or ("frmMeetingExhibitorsInfo") Then
'EnableControls Me, acDetail, True
Me!SpouseName.Enabled = True
Me!SpouseName = Me.OpenArgs
Me!SpouseName.SetFocus
Else
'EnableControls Me, acDetail, False
Me!SpouseName.Enabled = False


End If


End Sub

Private Sub Form_Open(Cancel As Integer)
End Sub

Private Sub Form_Unload(Cancel As Integer)
End Sub

----------

When I go into design mode of the form and compile, it highlights the first instance of IsLoaded. I've tried various modifications with no success. Any other thoughts?

Creeker
 
What version of Access? Is it possible that the IsLoaded() function has been defined in more than one code module or in code behind forms? Also, is another object in the database named IsLoaded?
You might try searching the entire databse for the string IsLoaded. Open a module, click Edit -> Find and search the current database.
 
1 - do you have more than one isloaded function in your project (do a search on current project, as mentioned by RobertT687)?
2 this line

[tt]If IsLoaded("frmMain") And (Forms![frmMain]![frmRegistrantsExhibitors] = "1") Then[/tt]

Will fail if frmMain isn't open because you're testing for both conditions. Same goes for the next place it's used. If the form isn't loaded, it will try to check something I don't quite understand, which is also commented on above by BobStubbs

[tt]If IsLoaded("frmMeetingRegistrantsInfo") Or ("frmMeetingExhibitorsInfo") Then[/tt]

What are you testing here??? See BobStubbs suggestion.

Roy-Vidar
 
I'm using Access 97.

There are 3 other forms and one module with code containing IsLoaded which is called modIsLoaded.

This form loads (or should) when trying to select a spouse for a registrant from a list box (on the frmMeetingRegistrantsInfo or frmMeetingRegistrantsInfo) when the spouse for that person is blank.

Carol

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top