Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / Database Access / October 2007



Tip: Looking for answers? Try searching our database.

Updating text box based on value from Drop down

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
navin - 29 Oct 2007 15:27 GMT
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.value) +
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
McKirahan - 29 Oct 2007 19:26 GMT
> Hi All,
>
[quoted text clipped - 10 lines]
> 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.