424 Error

Bultee

New member
Local time
Today, 21:43
Joined
Aug 29, 2010
Messages
2
I am a newbee trying to write a small one-off application. I have a form that displays a subform (frmGoogleMap) containing a google static map. When I select an item on the main form, the click calls the sub that creates the URL and loads the map. When I click I receive a 424 object required error message. After ending the debugger the map gets displayed OK

Code is:
Private Sub Combo20_Click()
SubForms!frmGoogleMap.Form_Timer
End Sub

Any help would be appreciated
Thanks
 
Is your code trying to invoke a function on the SubForm? The syntax is wrong for that. What is Form_Timer on the frmGoogleMap form? Can you post the code?
 
Yes I am calling a routine in another form.

Code below - someone had published it in a forum and I modified it for google staticmaps (MyAssigned is a global boolian variable and MyGoogleMapURL a global string)

Public Sub Form_Timer()
'Declare variables.
Dim objBrowser As Object
'Set variables.
Set objBrowser = Me.WebBrowser1
MyGoogleMapURL = "http://maps.google.com/maps/api/sta...0x520&maptype=terrain&markers=color:red|label:*|" & [Forms]![Well Header]![Latitude] & "," & [Forms]![Well Header]![Longitude] & "&sensor=false"

If MyAssigned = False Then
DoCmd.Hourglass True
With Me.WebBrowser1
.Navigate MyGoogleMapURL
Do Until .ReadyState <> 3
DoEvents
Loop
DoEvents
Do Until .ReadyState = 4
DoEvents
Loop
DoEvents
MyAssigned = True
End With
DoCmd.Hourglass False
End If
End Sub

Thanks
 
Because the Sub is Public, you can invoke it as a Method of the Form. Try this syntax:
Code:
Private Sub Combo20_Click()
   SubForms.FORM.Form_Timer
End Sub
...assuming your SubFormControl is named SubForms.
 

Users who are viewing this thread

Back
Top Bottom