Need proper Syntax to select Website Link

ggodwin
ggodwin used Ask the Experts™
on
I have a function in Access to retrieve some data from a web page. I need to get the correct syntax to access the next page of the process.

This is the code that I'm currently using that is not working.
   Set lnk = QPR.Document.Links(1)    ' 3=TMMK-VEH,4=TMMK-PWT,5=TMMC,6=TMMTX,7=TABC,8=NUMMI,9=TMMI,10=TMMBC,11=TMMAL,12=TMMNK
   lnk.Click

Open in new window


I believe the target page has been changed.

This is the source code of the page. I need to to click the link that is labeled "TMMK-VEH".
<html>
	<head>
	   <title>ToyotaSupplier.com: Supplier Key Performance Indicators</title>
	   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	   <link href="theme/Master.css" rel="stylesheet" type="text/css">
	   <script>
			function hidestatus() {
			    document.status = '';
			    return true;
			}
			if ( document.layers ) {
			    document.captureEvents( Event.MOUSEOVER | Event.MOUSEOUT );
			}
			document.onmouseover=hidestatus; document.onmouseout=hidestatus;
		</script>
		<script LANGUAGE="javascript" SRC="include/actionSubmitter.js"></script>
		
		
		
		
  
  		<script charset='UTF-8'>

			var environment = "prod";
			if(environment=='stage'){
					window['adrum-start-time'] = new Date().getTime();
					(function(config){
					    config.appKey = 'AD-AAB-AAH-WRX';
					    config.adrumExtUrlHttp = 'http://cdn.appdynamics.com';
					    config.adrumExtUrlHttps = 'https://cdn.appdynamics.com';
					    config.beaconUrlHttp = 'http://col.eum-appdynamics.com';
					    config.beaconUrlHttps = 'https://col.eum-appdynamics.com';
					    config.xd = {enable : false};
					})(window['adrum-config'] || (window['adrum-config'] = {}));
					if ('https:' === document.location.protocol) {
					    document.write(unescape('%3Cscript')
					 + " src='https://cdn.appdynamics.com/adrum/adrum-4.4.1.154.js' "
					 + " type='text/javascript' charset='UTF-8'" 
					 + unescape('%3E%3C/script%3E'));
					} else {
					    document.write(unescape('%3Cscript')
					 + " src='http://cdn.appdynamics.com/adrum/adrum-4.4.1.154.js' "
					 + " type='text/javascript' charset='UTF-8'" 
					 + unescape('%3E%3C/script%3E'));
					}
			}else if (environment=='prod'){
					window['adrum-start-time'] = new Date().getTime();
					(function(config){
					    config.appKey = 'AD-AAB-AAH-WRA';
					    config.adrumExtUrlHttp = 'http://cdn.appdynamics.com';
					    config.adrumExtUrlHttps = 'https://cdn.appdynamics.com';
					    config.beaconUrlHttp = 'http://col.eum-appdynamics.com';
					    config.beaconUrlHttps = 'https://col.eum-appdynamics.com';
					    config.xd = {enable : false};
					})(window['adrum-config'] || (window['adrum-config'] = {}));
					if ('https:' === document.location.protocol) {
					    document.write(unescape('%3Cscript')
					 + " src='https://cdn.appdynamics.com/adrum/adrum-4.3.3.5.js' "
					 + " type='text/javascript' charset='UTF-8'" 
					 + unescape('%3E%3C/script%3E'));
					} else {
					    document.write(unescape('%3Cscript')
					 + " src='http://cdn.appdynamics.com/adrum/adrum-4.3.3.5.js' "
					 + " type='text/javascript' charset='UTF-8'" 
					 + unescape('%3E%3C/script%3E'));
					}
			}
			
		</script>
		
		
		
	</head>
	
	
	
	<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
		<center>
			<table border="0" height="850" cellpadding="0" cellspacing="0" width="1040">
				<tr>
				    <td valign="top" class="bgWhite">
				        <center>
							<table border="0" cellpadding="0" cellspacing="0" width="1020">
								<tr>
									<td colspan="2"><img src="images/spacer.gif" width="1" height="5"></td>
								</tr>
							    <tr>
							        <td class="bgBlack"><img src="images/ts.gif"></td>
							        <td class="bgBlack" align="right">
							        	<span class="whtLink">
							        	    <a class="whtLink" href="SkpiGatewayServlet?jadeAction=AFFILIATE_LIST">SKPI Home</a>&nbsp;|&nbsp;
								          	
								          		<a class="whtLink" target="_blank" href="help/Supplier_KPI_Help_for_Suppliers.pdf">
								            
								            Help</a>&nbsp;|&nbsp;<a class="whtLink" href="javascript:window.close()">Logoff</a>&nbsp;&nbsp;
							            </span>
							    	</td>
							    </tr>
							    <tr>
							        <td><img name="appID" src="images/applicationID.gif" border="0" alt="Supplier KPI - Version 7.4"><img src="images/lines.gif" width="13%" height="20"></td>        
							        <td colspan="3" align="right" class="welcome">You are logged in as: Guy Godwin&nbsp[Supplier]</td>
							    </tr>
							    <tr>
							        <td colspan="5" class="subtitle" align="right" height="18"></td>
							    </tr>
							</table>
							<form name="skpiForm2" method="POST" action="">
								<input type="hidden" name="SKPI_AFFILIATE_CODE_KEY" value="">
								<input type="hidden" name="SKPI_AFFILIATE_DESC" value="">
								<input type="hidden" name="SKPI_SUPPLIER_CODE_KEY" value="">
								<input type="hidden" name="SKPI_SCRAP_TAG_NUMBER_KEY" value="">
								<input type="hidden" name="SKPI_NAV_NUMBER_KEY" value="">
								<input type="hidden" name="SKPI_HEADER_RECORD_KEY" value="">
							</form>
						





<SCRIPT LANGUAGE="javascript">
function doOnLoad()  {
    toggleDetail( 'B1' );
}
	
function setActionAndSubmitPage(affiliateCode, affiliateDesc) {
    document.skpiForm.SKPI_AFFILIATE_CODE_KEY.value = affiliateCode;
    document.skpiForm.SKPI_AFFILIATE_DESC.value = affiliateDesc;
    var formObject = document.skpiForm;
    var url = "SkpiGatewayServlet?jadeAction=SUPPLIER_LIST"  ;
    formObject.action = url;
    formObject.submit();
}

function setActionAndSubmitPageFromMap(url) {
    
    document.skpiForm.action = url;
    document.skpiForm.submit();
}

function getObjRef( name )  {
    if ( document.getElementById ) {
        return document.getElementById( name );
    }
    else if ( document.all ) {
        return document.all[name];
    }
    else if ( document.layers ) {
        return document.layers[name];
    }
}

function toggleDetail( input ) {
    var obj = getObjRef( input );
    if ( obj ) {
    	if ( obj.style.display == 'none' ) {
    		obj.style.display = 'block';
    	}
    	else {
    		obj.style.display = 'none';
    	}
    }
}

</SCRIPT>
<form name="skpiForm" method="POST" action="">
<input type="hidden" name="SKPI_AFFILIATE_CODE_KEY" value="">
<input type="hidden" name="SKPI_AFFILIATE_DESC" value="">
</form>
<table width="1000" cellpadding="0" cellspacing="0">
	<tr>
	   <td>
	       <table border="0" width="1000" cellpadding="0" cellspacing="0">
	           <tr>
		           <td class="pageH1" align="left">SKPI Home Page</td>
		           <td align="right">January 03, 2019</td>
		       </tr>
	       </table>
	   </td>
	</tr>
	<tr><td class="bgBlack"><img src="images/spacer.gif" width="1" height="3"/></td></tr>
	<tr><td><img src="images/spacer.gif" width="10" height="10"/></td></tr>
	<tr>
	   <td align="center">
	       <span class="message" style="font-size:14px"><font color="BLUE"> OCT18 DATA IS VIEWABLE IN THE SKPI-SPR (SEE TMMC NOTE BELOW).  PLEASE ADVISE SED5 OF ANY DISCREPANCIES AND BASE REPORTING ON THE OLD SPR, UNTIL THE SKPI-SPR REVIEW PHASE IS COMPLETE.<BR><br><font color="red">OUR I.S. TEAM IS WORKING TO RESOLVE THE TMMC DATA GAPS FOR SEP18 FORWARD.  RESOLUTION IS EXPECTED BY THE NEXT SPR.<BR><br> <font color="blue">After saving & opening the Performance Report, click "ENABLE CONTENT" to update report content.  <br><BR><font color="red">Please check SKPI DAILY to dispute any suspect data BEFORE the Dispute Cut-Off date. <br><br><font color="blue">The OCT18 SPR emailed on  11/28/18. THE OCT18 SKPI-SPR emailed on 11/30/18. <br> The NOV18 SPR's will email on 1/3 and 1/4/19.<br> <br><font color="red"> SPR Reports email from:  TEMAPCESupplierMgmt@tema.toyota.com <br> SKPI-SPR Reports email from:  SKPI@tema.toyota.com</span>
	   </td>
	</tr>
</table>
<table border="0" cellspacing="0" width="1000">
    <tr>
        <td><img src="images/spacer.gif" width="3" height="25" border="0" alt=""></td>
        <td><img src="images/spacer.gif" width="9%" height="25" border="0" alt=""></td>
        <td><img src="images/spacer.gif" width="74%" height="25" border="0" alt=""></td>
    </tr>
    <tr>
    	<td>&nbsp;</td>
        <td colspan="2" valign="top">
			<br>
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
	            <tr>
	            
	                <td valign="top">
						<table width="95%" border="0" align="left" cellpadding="0" cellspacing="0">
							<tr>
								<td class="tableTitleRow">NAMC<br>
								<img src="images/spacer.gif" width="50" height="1" border="0" alt=""></td>
	
								<td align="center"  class="tableTitleRow">Year to Date<br>
								Non-Conforming<br>(NC) Parts</td>
								<td align="center"  class="tableTitleRow">Year to Date<br>
								Delivery<br>Discrepancies</td>
		
							</tr>
		
                            <tr>
                                <td class="tableWhiteRow">
                                Bodine <span class="message">*</span>
                                </td>
                    
                                <td align="center" class="tableWhiteRow">&nbsp;</td>
                                <td align="center" class="tableWhiteRow">&nbsp;</td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableGrayRow">
                                CAPTIN <span class="message">*</span>
                                </td>
                    
                                <td align="center" class="tableGrayRow">&nbsp;</td>
                                <td align="center" class="tableGrayRow">&nbsp;</td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableWhiteRow">
                                TABC <span class="message">*</span>
                                </td>
                    
                                <td align="center" class="tableWhiteRow">&nbsp;</td>
                                <td align="center" class="tableWhiteRow">&nbsp;</td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableGrayRow">
                                <a href="javascript:setActionAndSubmitPage('00', 'TEMA')">TEMA</a>
                                </td>
                    
                                <td align="center" class="tableGrayRow">
                                0
                                </td>
                                <td align="center" class="tableGrayRow">
                                0
                                </td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableWhiteRow">
                                TEMA-MQC <span class="message">*</span>
                                </td>
                    
                                <td align="center" class="tableWhiteRow">&nbsp;</td>
                                <td align="center" class="tableWhiteRow">&nbsp;</td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableGrayRow">
                                TEMA-MQM <span class="message">*</span>
                                </td>
                    
                                <td align="center" class="tableGrayRow">&nbsp;</td>
                                <td align="center" class="tableGrayRow">&nbsp;</td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableWhiteRow">
                                TEMA-SVC <span class="message">&dagger;</span>
                                </td>
                    
                                <td align="center" class="tableWhiteRow">&nbsp;</td>
                                <td align="center" class="tableWhiteRow">&nbsp;</td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableGrayRow">
                                TMC <span class="message">&dagger;</span>
                                </td>
                    
                                <td align="center" class="tableGrayRow">&nbsp;</td>
                                <td align="center" class="tableGrayRow">&nbsp;</td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableWhiteRow">
                                <a href="javascript:setActionAndSubmitPage('15', 'TMMAL')">TMMAL</a>
                                </td>
                    
                                <td align="center" class="tableWhiteRow">
                                0
                                </td>
                                <td align="center" class="tableWhiteRow">
                                0
                                </td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableGrayRow">
                                <a href="javascript:setActionAndSubmitPage('20', 'TMMBC')">TMMBC</a>
                                </td>
                    
                                <td align="center" class="tableGrayRow">
                                0
                                </td>
                                <td align="center" class="tableGrayRow">
                                0
                                </td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableWhiteRow">
                                <a href="javascript:setActionAndSubmitPage('21', 'TMMC')">TMMC</a>
                                </td>
                    
                                <td align="center" class="tableWhiteRow">
                                5
                                </td>
                                <td align="center" class="tableWhiteRow">
                                0
                                </td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableGrayRow">
                                TMMC-W <span class="message">&dagger;</span>
                                </td>
                    
                                <td align="center" class="tableGrayRow">&nbsp;</td>
                                <td align="center" class="tableGrayRow">&nbsp;</td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableWhiteRow">
                                TMMGT <span class="message">*</span>
                                </td>
                    
                                <td align="center" class="tableWhiteRow">&nbsp;</td>
                                <td align="center" class="tableWhiteRow">&nbsp;</td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableGrayRow">
                                <a href="javascript:setActionAndSubmitPage('02', 'TMMI')">TMMI</a>
                                </td>
                    
                                <td align="center" class="tableGrayRow">
                                0
                                </td>
                                <td align="center" class="tableGrayRow">
                                0
                                </td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableWhiteRow">
                                <a href="javascript:setActionAndSubmitPage('P1', 'TMMK-PWT')">TMMK-PWT</a>
                                </td>
                    
                                <td align="center" class="tableWhiteRow">
                                0
                                </td>
                                <td align="center" class="tableWhiteRow">
                                0
                                </td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableGrayRow">
                                <a href="javascript:setActionAndSubmitPage('01', 'TMMK-VEH')">TMMK-VEH</a>
                                </td>
                    
                                <td align="center" class="tableGrayRow">
                                1
                                </td>
                                <td align="center" class="tableGrayRow">
                                0
                                </td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableWhiteRow">
                                <a href="javascript:setActionAndSubmitPage('04', 'TMMMS')">TMMMS</a>
                                </td>
                    
                                <td align="center" class="tableWhiteRow">
                                0
                                </td>
                                <td align="center" class="tableWhiteRow">
                                0
                                </td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableGrayRow">
                                TMMNK <span class="message">*</span>
                                </td>
                    
                                <td align="center" class="tableGrayRow">&nbsp;</td>
                                <td align="center" class="tableGrayRow">&nbsp;</td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableWhiteRow">
                                <a href="javascript:setActionAndSubmitPage('03', 'TMMTX')">TMMTX</a>
                                </td>
                    
                                <td align="center" class="tableWhiteRow">
                                0
                                </td>
                                <td align="center" class="tableWhiteRow">
                                0
                                </td>
                                
                            </tr>
                    
                            <tr>
                                <td class="tableGrayRow">
                                <a href="javascript:setActionAndSubmitPage('14', 'TMMWV')">TMMWV</a>
                                </td>
                    
                                <td align="center" class="tableGrayRow">
                                0
                                </td>
                                <td align="center" class="tableGrayRow">
                                0
                                </td>
                                
                            </tr>
                    
		            	</table>
	                </td>
	                <td width="5"><img src="images/spacer.gif" width="5" height="1" border="0" alt=""></td>
	                <td width="280" align="left">
					    <img src="images/affiliateMap.gif" border="0">
					</td>
	            </tr>
	            <tr>
	            	<td><img src="images/spacer.gif" width="10" height="10" border="0" alt=""></td>
	            </tr>
	            <tr>
	            	<td>Open <a href="/skpi/SkpiGatewayServlet?jadeAction=DISPUTE_SEARCH">Disputes</a>: 25</td>
	            </tr>
	            
	            <tr>
	            	<td><a href="#" onclick="window.open('downloadDisputeFormServlet','_blank')">Download NAMC Dispute Contact &amp; Dispute Request Form </a></td>
	            </tr>
	            
	            <tr>
	            	<td><img src="images/spacer.gif" width="10" height="10" border="0" alt=""></td>
	            </tr>
	        </table>
		</td>
    </tr>
</table>
<br>


<table border="0" cellpadding="0" cellspacing="0" width="990">
    <tr><td><img src="images/spacer.gif" width="20" height="20" border="0" alt=""></td><td class="tableWhiteRow"><span class="message">*</span> <I>Indicates that this NAMC has reported no data for the supplier codes assigned to you.</I></td></tr>
    <tr><td><img src="images/spacer.gif" width="20" height="20" border="0" alt=""></td><td class="tableWhiteRow"><span class="message">&dagger;</span> <I>Indicates that you do not have access to this NAMC.</I></td></tr>
</table>



<img src="images/spacer.gif" width="10" height="10" border="0" alt=""><br>
<img src="images/spacer.gif" width="25" height="20" border="0" alt=""><a style="COLOR:BLUE;" name="t1" href="#" onClick="toggleDetail('b1')" class="tableWhiteRow">View My Assigned NAMC/Supplier Codes</a>
<table>
<tr>
<td><img src="images/spacer.gif" width="30" height="10" border="0" alt=""></td>
<td>
<div style="display:none" id="b1" align="left">
<table border="0" cellpadding="0" cellspacing="0" width="410">
    <tr><td><img src="images/spacer.gif" width="20" height="10" border="0" alt=""></td></tr>
    <tr><td><img src="images/spacer.gif" width="20" height="1" border="0" alt=""></td><td class="tableTitleRow" colspan="4"><B>Assigned NAMC/Supplier Code Combinations</B></td></tr>
    
    <tr><td><img src="images/spacer.gif" width="20" height="1" border="0" alt=""></td><td class="tableWhiteRow" align="left" colspan="4">TEMA: 1950,1951,1952,1953,1954</td></tr><tr><td><img src="images/spacer.gif" width="20" height="1" border="0" alt=""></td><td class="tableGrayRow" align="left" colspan="4">TMMNK: 1950,1951,1952,1953</td></tr><tr><td><img src="images/spacer.gif" width="20" height="1" border="0" alt=""></td><td class="tableWhiteRow" align="left" colspan="4">TMMK-VEH: 1950,1951,1952,1953,1954</td></tr><tr><td><img src="images/spacer.gif" width="20" height="1" border="0" alt=""></td><td class="tableGrayRow" align="left" colspan="4">TMMI: 1950,1951,1952,1953,1954</td></tr><tr><td><img src="images/spacer.gif" width="20" height="1" border="0" alt=""></td><td class="tableWhiteRow" align="left" colspan="4">TMMTX: 1950,1951,1952,1953,1954</td></tr><tr><td><img src="images/spacer.gif" width="20" height="1" border="0" alt=""></td><td class="tableGrayRow" align="left" colspan="4">TMMMS: 1950,1951,1952,1953,1954</td></tr><tr><td><img src="images/spacer.gif" width="20" height="1" border="0" alt=""></td><td class="tableWhiteRow" align="left" colspan="4">TMMK-PWT: 1950,1951,1952,1953,1954</td></tr><tr><td><img src="images/spacer.gif" width="20" height="1" border="0" alt=""></td><td class="tableGrayRow" align="left" colspan="4">TABC: 1950,1951,1952,1953,1954</td></tr><tr><td><img src="images/spacer.gif" width="20" height="1" border="0" alt=""></td><td class="tableWhiteRow" align="left" colspan="4">TMMWV: 1950,1951,1952,1953,1954</td></tr><tr><td><img src="images/spacer.gif" width="20" height="1" border="0" alt=""></td><td class="tableGrayRow" align="left" colspan="4">TMMAL: 1950,1951,1952,1953,1954</td></tr><tr><td><img src="images/spacer.gif" width="20" height="1" border="0" alt=""></td><td class="tableWhiteRow" align="left" colspan="4">TMMBC: 1950,1951,1952,1953,1954</td></tr><tr><td><img src="images/spacer.gif" width="20" height="1" border="0" alt=""></td><td class="tableGrayRow" align="left" colspan="4">TMMC: 1000</td></tr>
   
    <tr><td><img src="images/spacer.gif" width="20" height="10" border="0" alt=""></td></tr>
     
</table>
<img src="images/spacer.gif" width="25" height="10" border="0" alt=""><span class="tableWhiteRow"><I>Your Supplier Administrator assigns NAMC/Supplier Code combinations.</I></span>
</div>
</td></tr></table>
<br><img src="images/spacer.gif" width="10" height="10" border="0" alt="">








			            </center>
			        </td>
			    </tr>
			</table>
			<table border="0" cellpadding="0" cellspacing="0" width="1040">
			    <tr>
			        <td class="bgWhite">
			            <center>
							<table border="0" cellpadding="0" cellspacing="0" width="1020">
							    <tr>
							        <td class="bgBlack"><img src="images/ts.gif"></td>
							        <td class="bgBlack" align="right">
							        	<span class="whtLink">
							        	    <a class="whtLink" href="SkpiGatewayServlet?jadeAction=AFFILIATE_LIST">SKPI Home</a>&nbsp;|&nbsp;
								          	
								          		<a class="whtLink" target="_blank" href="help/Supplier_KPI_Help_for_Suppliers.pdf">
								            
								            Help</a>&nbsp;|&nbsp;<a class="whtLink" href="javascript:window.close()">Logoff</a>&nbsp;&nbsp;
							            </span>
							    	</td>
							    </tr>
							   	<tr>
									<td colspan="2"><img src="images/spacer.gif" width="1" height="5"></td>
								</tr>
							</table>
			            </center>
			        </td>
			    </tr>
			</table>

        </center>
    </body>
</html>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Zakaria AcharkiAnalyst Developer
Distinguished Expert 2018

Commented:
First of all, make sure the QPR.Document object is already filled then try to adjust the link index since the link that is labeled "TMMK-VEH" is the in the 7th position, try :

Set lnk = QPR.Document.Links(7)

Open in new window

ggodwinQuality Engineer

Author

Commented:
Same results. It would be OK if it selected any of the links at this point. Currently, it just stalls out and doesn't try to do anything.

What do you mean by "make sure the QPR.Document is already filled in"?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial