Updating text box based on value from Drop down

Hi All,

I have designed a webpage for my office and have published the site
from my system. In my webpage, I have a drop down which contains
different activities we work on, which is stored in a database. My
requirement is that, as
soon as user selects an activity, page should retrieve all the
volumes
processed by user from the databse and update a text box immediately.

Below code is what i am using in my page and this works fine and
displays the desired value in the text box when i am using the site on
my system, but does not work when any other tries to use the page and
text box remains blank:

<script language="vbscript">

Sub activityChange()
Dim conADO
Dim rsADO
Dim sqlADO
Dim ACTDATE
Dim ACTName
Dim ACT
Dim DBPath
Dim OB
Dim PreACTDate
Dim Check

FrontPage_Form1.OPBal.value=""
FrontPage_Form1.rec.value=""
FrontPage_Form1.allo.value=""
FrontPage_Form1.proc.value=""
FrontPage_Form1.VolTot.value=""

ACTDATE= FrontPage_Form1.actDT.value
'msgbox(Weekday(Cdate(ACTDATE)))
if weekday(CDate(ACTDATE))=2 then
PreACTDate=CDate(ACTDATE)-3
'msgbox(PreACTDate)
else
PreACTDate=CDate(ACTDATE)-1
'msgbox(PreACTDate)
end if

ACTNAME = FrontPage_Form1.buyers.value
ACT = FrontPage_Form1.activity.value

Set conADO= CreateObject("ADODB.Connection")
conADO.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:
\ACSPortal\pages\acsdata.mdb;"

Set rsADO= CreateObject("ADODB.Recordset")
sqlADO="SELECT * FROM tblEODAct WHERE actDate=" & "#" & PreACTDate &
"#" & " AND buyerName=" & "'" & ACTNAME & "'" & " AND activity=" & "'"
& ACT & "'"

rsado.Open sqlado,conado

if rsADO.EOF=true then
OB=CInt(0)
Else
OB=rsADO.Fields("actTotal").Value - rsADO.Fields("actProc").Value
End if

FrontPage_Form1.OPBal.value=OB
End Sub

Sub rec_OnBlur()
if FrontPage_Form1.rec.value="" then
msgbox("Please Enter a Value For Received or Enter 0")
'FrontPage_Form1.rec.select
end if
End Sub

Sub allo_OnBlur()
If FrontPage_Form1.allo.value = "" then
msgbox("Please Enter a Value For Allocated or Enter 0")
FrontPage_Form1.allo.select
else
FrontPage_Form1.VolTot.value=CInt(FrontPage_Form1.OPBal.valu e) +
CInt(FrontPage_Form1.rec.value) + CInt(FrontPage_Form1.allo.value)
end if

End Sub

Sub proc_OnBlur()
if FrontPage_Form1.proc.value="" then
msgbox("Please Enter a Value For Processed or Enter 0")
' 'FrontPage_Form1.rec.select
end if
End Sub


'Sub SubmitData_Onclick()
' If FrontPage_Form1.rec.value="" then
' msgbox("Please Enter a Value For Received or Enter 0",,"Received
Field Empty")
' FrontPage_Form1.rec.select
' Else if FrontPage_Form1.allo.value="" then
' msgbox("Please Enter a Value For Allocated or Enter 0",,"Allocated
Field Empty")
' FrontPage_Form1.allo.select
' else
' msgbox("Please Enter a Value For Processed or Enter 0",,"Processed
Field Empty")
' FrontPage_Form1.allo.select
' End if

'End Sub

</script>

Please help and let me know where i am wrong in above.

Thanks,
Navin
navin [ Mo, 29 Oktober 2007 15:27 ] [ ID #1857029 ]

Re: Updating text box based on value from Drop down

"navin" <navin.narayana [at] gmail.com> wrote in message
news:1193668049.267674.128980 [at] k79g2000hse.googlegroups.com.. .
> Hi All,
>
> I have designed a webpage for my office and have published the site
> from my system. In my webpage, I have a drop down which contains
> different activities we work on, which is stored in a database. My
> requirement is that, as
> soon as user selects an activity, page should retrieve all the
> volumes
> processed by user from the databse and update a text box immediately.
>
> Below code is what i am using in my page and this works fine and
> displays the desired value in the text box when i am using the site on
> my system, but does not work when any other tries to use the page and
> text box remains blank:

[snip]

http://www.aspfaq.com/5003
McKirahan [ Mo, 29 Oktober 2007 20:22 ] [ ID #1857030 ]
Webserver » microsoft.public.inetserver.asp.db » Updating text box based on value from Drop down

Vorheriges Thema: BLOB to MS Word via ASP/VBScript
Nächstes Thema: Drop down list