By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,575 Members | 1,413 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,575 IT Pros & Developers. It's quick & easy.

VBA help

P: n/a

Hi,
I have following code that opens microsoft web browser within access.
when I click this button on main form I keep getting an error "can't
find field 'webBrowser0' refered in your expression"

Private Sub CRM_Click()
On Error GoTo Err_CRM_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim wb As SHDocVw.WebBrowser_V1
stDocName = "FrmCRM"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Set wb = Me!WebBrowser0.Object

With wb
' .Navigate Me.URL
.Navigate "http://crm/login.asp"

Do While .Busy: DoEvents: Loop
Do While .ReadyState <4: DoEvents: Loop

With .Document.Forms(0)
' Set the dates.
.username.Value = "username"
.password.Value = "password"
' Click Submit to run the report.
.submit
End With
End With
Set wb = Nothing
Exit_CRM_Click:
Exit Sub

Err_CRM_Click:
MsgBox Err.Description
Resume Exit_CRM_Click

End Sub
thank you
hj

ps: bear with me I am still learning vba. your small hints would be
more then enough to point me towards right sources...

Oct 2 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a

here is some more info what I want to do...

I have created a form with webbrowes control. I have created a command
button on my main form. I am trying to open the webbrowser form when
user clicks the command button and it will also supply the url,
username and password to fill up in browser.

hj

Oct 2 '06 #2

P: n/a
you have a 0 in ME.webbrowes0.object but you say your field name is
webbrowes.

Hitesh Joshi wrote:
here is some more info what I want to do...

I have created a form with webbrowes control. I have created a command
button on my main form. I am trying to open the webbrowser form when
user clicks the command button and it will also supply the url,
username and password to fill up in browser.

hj
Oct 2 '06 #3

P: n/a
Try

Set wb = Me.WebBrowser0.Object

and note what the intellisense pops up when you press the . after Me
--

Terry Kreft
"Hitesh Joshi" <hi*******@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
>
Hi,
I have following code that opens microsoft web browser within access.
when I click this button on main form I keep getting an error "can't
find field 'webBrowser0' refered in your expression"

Private Sub CRM_Click()
On Error GoTo Err_CRM_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim wb As SHDocVw.WebBrowser_V1
stDocName = "FrmCRM"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Set wb = Me!WebBrowser0.Object

With wb
' .Navigate Me.URL
.Navigate "http://crm/login.asp"

Do While .Busy: DoEvents: Loop
Do While .ReadyState <4: DoEvents: Loop

With .Document.Forms(0)
' Set the dates.
.username.Value = "username"
.password.Value = "password"
' Click Submit to run the report.
.submit
End With
End With
Set wb = Nothing
Exit_CRM_Click:
Exit Sub

Err_CRM_Click:
MsgBox Err.Description
Resume Exit_CRM_Click

End Sub
thank you
hj

ps: bear with me I am still learning vba. your small hints would be
more then enough to point me towards right sources...

Oct 3 '06 #4

P: n/a
Thank you all for your input. I've resolved it. I am using form_load()
method now rather when a web browser loads. That resolves this issue.

Thanks,
hj
Hitesh Joshi wrote:
Hi,
I have following code that opens microsoft web browser within access.
when I click this button on main form I keep getting an error "can't
find field 'webBrowser0' refered in your expression"

Private Sub CRM_Click()
On Error GoTo Err_CRM_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim wb As SHDocVw.WebBrowser_V1
stDocName = "FrmCRM"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Set wb = Me!WebBrowser0.Object

With wb
' .Navigate Me.URL
.Navigate "http://crm/login.asp"

Do While .Busy: DoEvents: Loop
Do While .ReadyState <4: DoEvents: Loop

With .Document.Forms(0)
' Set the dates.
.username.Value = "username"
.password.Value = "password"
' Click Submit to run the report.
.submit
End With
End With
Set wb = Nothing
Exit_CRM_Click:
Exit Sub

Err_CRM_Click:
MsgBox Err.Description
Resume Exit_CRM_Click

End Sub
thank you
hj

ps: bear with me I am still learning vba. your small hints would be
more then enough to point me towards right sources...
Oct 3 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.