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

SubForm Error When opening IE

MitchR
P: 63
Good Day Folks;

I have found myself in a hole I can't get out. In Access Version 2000 I have a form Called Frm_Main That contains a SubForm Frm_Main_Sub. Frm_Main_Sub's record source is a select query with linked Master and child Data. Frm_Main_Sub dispays two things the Word Returned and a UPS Tracking number.This all works just fine until I decided to be a good samaritan and try to add the ability to Track the Tracking number with a command button. Ordinarily I drop the

Code:
--------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  2.  
--------------------------------------------------------------------------------


and the Declare my ups link with my Tracking number
Code:
--------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. Dim myLink As StringmyLink = "http://wwwapps.ups.com/WebTracking/processRequest?HTMLVersion=5.0&Requester=NES&AgreeToTermsAndConditions=yes&loc=en_US&tracknum=" & Me.Text9 & ""ShellExecute hWnd, "open", myLink, vbNullString, vbNullString, Empty
  2.  
--------------------------------------------------------------------------------


Placed in Frm_Main the code works great. However If I place it in the Subform I get :
The Expression On Click you entered in the as the Event property setting produced the following error : A Problem occurred while DB Name was communicating with the OLE Server or Active X Control

Thank you in advance for the help
May 22 '08 #1
Share this Question
Share on Google+
4 Replies


puppydogbuddy
Expert 100+
P: 1,923
If it works great on the main form, then Text9 must be on the main form and therefore, you can not use Me as the qualifier. Try using Parent in place of Me or use your actual main form name.
May 22 '08 #2

MitchR
P: 63
I appreciate the response !!!!!!


Text9 is actually on the sub form. Even if I remove the variable and just try to open UPS.COM the script will not fire and throws up the error. Anything else that might prevent me from firing this ?
May 22 '08 #3

puppydogbuddy
Expert 100+
P: 1,923
Mitch,
It sounds like it is a Private vs Public issue on the shell code. If you've taken two code procs that were executed in sequence from your main form, then it works because both procs are executing within the same form, and therefore the Shell code could be kept private.

Now that you are executing the shell code from your main form and the other code from your subform, I believe you need to make your shell code public....i.e.place the shell code in a standard module and labeled as a Public Sub. Then all you need to do is call it from wherever you need it. You probably need to call the shell once from the mainform as you have always done, and then once from the subform in response to the tracking button click.

Let me know what happens.
May 22 '08 #4

Expert Mod 2.5K+
P: 2,545
Hi MitchR and PuppyDogBuddy. Mitch, are you sure your code is correct? There appears to be either a missing double quote or a missing & operator at the point below marked with V. I would have thought you would get a compiler error there, as the two double quotes form an empty string which is not joined to the ShellExecute part by any operator.
Expand|Select|Wrap|Line Numbers
  1. ---------------V
  2. & Me.Text9 & ""ShellExecute hWnd, "open", myLink, vbNullString, vbNullString, Empty
  3.  
-Stewart
May 22 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.