Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6729047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:14:32+00:00 2026-05-26T10:14:32+00:00

I have VBS code in an html page that gets queries from an access

  • 0

I have VBS code in an html page that gets queries from an access database. I am trying to print the result of a query at the right place in the html using

document.write(fDateDispo & " et " & tDateDispo)

where fDateDispo and tDateDispo are public variables declared before all subs in the program. In one of my procedure (declared Public Sub) I give the public vars their values with the query result. I used a msgbox() to confirm that the right values are attributed when the procedure runs.

My problem is that the value I give to the public variables during the procedure doesn’t stay after it has been executed, they are just empty and only the “et” gets printed.

[EDIT]
here is the code:

public sub SendQuery(DateOne,DateTwo)
On Error Resume Next
    dim rs, passerelle, nbrAppels, c, stSQLpass
    dim Objet, nbrObjet, stSQLobj, rsObj
    dim Panne, nbrPanne, stSQLpan, rsPan
    dim SQLfromDate, SQLtoDate, stWhere, FromDate, ToDate


SQLfromDate="SELECT Min(Avis.[Date Appel]) AS [MinDeDate Appel] FROM Avis;"
SQLtoDate="SELECT Max(Avis.[Date Appel]) AS [MaxDeDate Appel] FROM Avis;"


ADOConnection1.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=G:\Planification\Planification\Stagiaires\Sébastien Leblanc\EntretienElectro_Backup2.mdb"
Set FromDate = ADOConnection1.Execute(SQLfromDate)
Set ToDate = ADOConnection1.Execute(SQLtoDate)

fDateDispo=FromDate.Fields(0).Value
tDateDispo=ToDate.Fields(0).Value

With rs
    .MoveFirst
    Do While Not .EOF
        passerelle = passerelle & .Fields(1).Value & Chr(9)
        nbrAppels = nbrAppels & .Fields(0).Value & Chr(9)
        .MoveNext
    Loop
    .Close
End With
' Remove the leftover tab character at the end of the strings.
passerelle = Left(passerelle, Len(passerelle) - 1)
nbrAppels = Left(nbrAppels, Len(nbrAppels) - 1)
' Objet cahrtspace1
With ChartSpace1
    .Clear
    .Charts.Add
    Set c = .Constants
    .AllowFiltering = True     
    .Interior.Color = "white"     
    With .Charts(0)
        .Border.Color = "white"
        .Interior.Color = "white"
        .Axes(0).Hastitle = TRUE
        .Axes(0).Title.Caption = "Passerelles"          'titre de l'axes des x
        .Axes(1).Hastitle = TRUE
        .Axes(1).Title.Caption = "Nombre d'Appels"      'titre de l'axe des y
        .SeriesCollection.Add
        .PlotArea.Interior.Color = "white"              du graph
        With .SeriesCollection(0)
            .Interior.Color = RGB(61, 166, 228)      

            .SetData c.chDimCategories, c.chDataLiteral, nbrAppels
            .SetData c.chDimValues, c.chDataLiteral, passerelle
        End With  

        .Type = c.chChartTypeColumnClustered
    End With
End With


    ADOConnection1.Close
End sub

i left out a couple of things because I doubt it has anything to do with it. its just other OWC objects and stuff…
I tried just attributing a value by doing fDateDispo="date" in the sub, but no luck.

[EDIT 2]

This is client-side VBscript. The sub is in the <head> and the document write is in the <body> of the html.the sub is called by an other sub set as window_load event.

[EDIT 3]

here is where i place my document.write() :

    <P style="PAGE-BREAK-AFTER: auto"><FONT face=Arial>&nbsp;&nbsp;&nbsp; Les 
      données entre les dates
      <SCRIPT language=vbscript>

Document.write(fDateDispo & " et " & tDateDispo)

      </SCRIPT>
       sont disponibles.</FONT></P>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:14:32+00:00Added an answer on May 26, 2026 at 10:14 am

    Hopefully I’m following this correctly, but to illustrate my comment:

    <html>
        <head>
            <script language="vbscript">
                dim var: var = Empty
    
                public sub subroutine()
                    var = "blah"
                end sub
    
                public sub loadhandler()
                    call subroutine()
                    dim d: set d = document.getElementById("thediv")
                    d.innerText = var
                end sub
            </script>
        </head>
        <body onload="call loadhandler()">
            <script language="vbscript">
                document.write "document.write('" & var & "')"
            </script>
            <div id="thediv"/>
        </body>
    </html>
    

    when loaded, the output is

    document.write(”)
    blah

    meaning that the document.write() is called before loadhandler(), which is why var is Empty in the first line in the output

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code I'm trying to rewrite to c# from a vbs script.
I'm trying to make a small VBScript that compacts a MS Access 2007 database
I have a VBS file that I am trying to use to determine what
Does anyone have sample VBS code that creates a switch statement based on whether
Does anyone have sample VBS code that sends a variable, waits response and repeat?
I'm trying to minimize the number of vbs files that I have for a
I have this .vbs script that I am trying to run on windows 7.
I'm trying to read xml file from vbs script. Xml is encoded in utf-8
I have a text file that ends with .vbs that I have written the
I have a bit of ported code. It was automatically converted from VB6 to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.