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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't retrieve value of text box

Status
Not open for further replies.

SarahG

Programmer
May 23, 2002
111
IE
Hi
I'm new to VBScript, so this is probably a very simple issue.
I've created a Data Access Page in Access 2000, and it uses 4 tables to group data into a hierarchy. I have a command button at one of the levels, which on clicking will retrieve the record the user is currently on.
In order to do this I want to retrieve th value of one of the text boxes at that level and am using the code:

Dim sMsg
sMsg = document.all.item("txtLevel4Desc").Value

but I get an error when I click on the button telling me the property isn't supported. I'm not sure why this is incorrect as it is listed on the Microsoft site. Is there an alternative way to do this?
Also if anyone can suggest a good website as a starting point for using VBScript with access that's be great.
Thanks in advance.
 
Hello SarahG,

Try instead this?
[tt] document.all("txtLevel4Desc").value[/tt]

regards - tsuji
 
Just tried that, it gives me a message saying "object required".
If I change the name of the text control to be the name of the underlying field, it gives me the original message saying it doesn't support the proprty or method.
 
SarahG,

It can be a very misleading error message of browser once the event-handler containing any kind of error. Show your waterdowned design? Otherwise take a look of this raw demo. (Also be mindful of browser compatibility.)
Code:
<html>
<head>
<script language="vbscript">
sub displayit
	msgbox document.all("txtLevel4Desc").value
end sub
</script>
</head>
<body>
<form>
<input type="text" name="txtLevel4Desc" />
<input type="button" name="capture" value="capture" onclick="displayit" />
</form>
</body>
</html>
- tsuji
 
Hi,
the code for this page is generated by MS Access. This code does not contain <FORM> </FORM> tags, although I can see the definion of the controls within the <BODY></BODY> tags. The definitions are as follows:

Text Control:
<TEXTAREA id=txtMDC_ICD_LEVEL3_DESC title=MDC_ICD_LEVEL3_DESC style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; LEFT: 2.012cm; BORDER-BOTTOM-WIDTH: 0px; OVERFLOW: hidden; WIDTH: 17.161cm; POSITION: absolute; TOP: 0cm; HEIGHT: 0.476cm; BORDER-RIGHT-WIDTH: 0px" tabIndex=2 cols=131></TEXTAREA>

Command Button:
<BUTTON id=cmdSelect title=Command0
style="LEFT: 0.503cm; WIDTH: 1.11cm; POSITION: absolute; TOP: 0.107cm; HEIGHT: 0.448cm"
tabIndex=6>Select</BUTTON>

I'm only adding in the following code between the <HEAD> tags:

<SCRIPT language=vbscript event=onclick for=cmdSelect>
msgbox document.all("txtMDC_ICD_LEVEL3_DESC").value
</SCRIPT>

Thanks....
 
SarahG,

I put something dumb in the textarea and is it working for you on ie?
Code:
<html>
<head>
<SCRIPT language=vbscript event=onclick for=cmdSelect>
    msgbox document.all("txtMDC_ICD_LEVEL3_DESC").value
</SCRIPT>
</head>
<body>
<span>
<TEXTAREA id=txtMDC_ICD_LEVEL3_DESC title=MDC_ICD_LEVEL3_DESC style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; LEFT: 2.012cm; BORDER-BOTTOM-WIDTH: 0px; OVERFLOW: hidden; WIDTH: 17.161cm; POSITION: absolute; TOP: 1cm; HEIGHT: 0.476cm; BORDER-RIGHT-WIDTH: 0px" tabIndex=2 cols=131>sfasdsdfadfsadasdfaf</TEXTAREA>
</span>
<p /><p />
<BUTTON id=cmdSelect title=Command0 
style="LEFT: 0.503cm; WIDTH: 1.5cm; POSITION: absolute; TOP: 0.107cm; HEIGHT: 0.8cm" 
tabIndex=6>Select</BUTTON>
</body>
</html>
- tsuji
 
Hi tsuji

I put in the sfasdsdfadfsadasdfaf bit. It doesn't give an error for this, it just gives the original "doesn't support" message.

 
SarahG,

On ie6 it shows something amid useless, at least?!

- tsuji
 
Hi tsuji,
I had a closer look, all it did was insert this as the value in that text field - this is only visible in design view. I am also using v6.
Is it the fact that it is a data access page with <TEXTAREA> tags that it is causing a problem?
Sorry this is turning into an epic...
 
SarahG,

Most probably then. I'm calling the day. If I can come up with a demo of concept, I would be happier.

- tsuji
 
Thanks a million for looking into this, when I get to know vbscript better I will probably kick myself.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top