Search code examples
powershellms-accessvbscripthta

Doing an Access Query with PS Script over VB and writing output in HTA Textbox


I am new to PowerShell and got the following Task.
I have to Create a HTA GUI where you can write the Name to search for in the Access Query.
The VB Script in the HTA File starts the PS Script and passes the Parameter of the user Input in the HTA TextBox. After that the PowerShell Script does a Access Query with the user Input to get some results. These results should somehow get back to the VB/HTA File so it can Output every single result in an other TextBox.

Is this even possible to do? If yes, i would appreciate some solution ideas.

EDIT:

VB/HTA

VB/HTA

Wrong Format, should be like a table


Solution

  • You have strLine in the HTA code that reads the text file. Your code is reading the text file and taking 1 line and putting it in a text input box. In order to show the results as a table you need to create the table HTML and pass that HTML to a div element.

    strLine = "<table>"
    Do While Not strLines.AtEndOfStream
       strLine = strLine & "<tr><td>" & strLines.ReadLine() & "</td></tr>"
    Loop
    strLine = strLine & "</table>"
    Weiterleitung_div.innerHTML = strLine
    

    You will need to change Weiterleitung_id.value = strLine and instead pass the strLine HTML to a element in the body. Add to the body and then