Hta file to get all details from ADS needs to be included with more deata.

Hi,

The below Hta file when entered any category will get all the other details from Active directory.
I need to add some more options and even set the order accordingly.,

Attached is the file that has to extract in the order.

Regards
Sharath
<head>
<title>User Information</title>
<HTA:APPLICATION 
     APPLICATIONNAME="User Information"
     BORDER="thin"
     SCROLL="no"
     SINGLEINSTANCE="yes"
     WINDOWSTATE="normal"
>
</head>
 
<script language="VBScript">
 
' Global variables
Dim arrRows
 
Sub Window_OnLoad
      intWidth = 800
      intHeight = 600
      Me.ResizeTo intWidth, intHeight
      Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
      btnFirstEvent.Disabled = True
      btnPreviousEvent.Disabled = True
      btnNextEvent.Disabled = True
      btnLastEvent.Disabled = True
      btnFirstEvent.Style.Visibility = "Hidden"
      btnPreviousEvent.Style.Visibility = "Hidden"
      btnNextEvent.Style.Visibility = "Hidden"
      btnLastEvent.Style.Visibility = "Hidden"
End Sub
 
Sub Default_Buttons
      If Window.Event.KeyCode = 13 Then
            btn_submit.Click
      ElseIf Window.Event.KeyCode = 27 Then
            Clear_Form
      End If      
End Sub
 
Sub Clear_Form
      txt_name.Value = ""
      txt_name.style.backgroundColor="#FFFFFF"
      txt_name.Disabled = False
      txt_loginname.Value = ""
      txt_loginname.style.backgroundColor="#FFFFFF"
      txt_loginname.Disabled = False
      txt_email.Value = ""
      txt_email.style.backgroundColor="#FFFFFF"
      txt_email.Disabled = False
      txt_empid.Value = ""
      txt_empid.style.backgroundColor="#FFFFFF"
      txt_empid.Disabled = False
      txt_designation.Value = ""
      txt_designation.style.backgroundColor="#FFFFFF"
      txt_designation.Disabled = False
      txt_extensionno.Value = ""
      txt_extensionno.style.backgroundColor="#FFFFFF"
      txt_extensionno.Disabled = False
      txt_mobileno.Value = ""
      txt_mobileno.style.backgroundColor="#FFFFFF"
      txt_mobileno.Disabled = False
      txt_notes.Value = ""
      txt_notes.style.backgroundColor="#FFFFFF"
      txt_notes.Disabled = False
      txt_department.Value = ""
      txt_department.style.backgroundColor="#FFFFFF"
      txt_department.Disabled = False
      btnFirstEvent.Style.Visibility = "Hidden"
      btnPreviousEvent.Style.Visibility = "Hidden"
      btnNextEvent.Style.Visibility = "Hidden"
      btnLastEvent.Style.Visibility = "Hidden"
      span_currentrecord.InnerHTML = "0"
      span_totalrecords.InnerHTML = "0"
End Sub
 
Sub Submit_Form
 
      arrFields = Array(_
            "txt_name", _
            "txt_loginname", _
            "txt_email", _
            "txt_empid", _
            "txt_designation", _
            "txt_extensionno", _
            "txt_mobileno", _
            "txt_notes", _
            "txt_department")
      
      boolValid = False
      For Each strField In arrFields
            If Eval(strField & ".Disabled") = True Then
                  boolValid = True
            End If
            If Eval(strField & ".Disabled") = False Then
                  strCurrentField = strField
            End If
      Next
      
      If boolValid = False Then strCurrentField = "INVALID"
      
      Select Case strCurrentField
            Case "txt_name"
                  If txt_name.Value = "" Then
                              strSearchField = "(cn=*)"
                        Else
                              strSearchField = "(cn=*" & txt_name.Value & "*)"
                        End If
            Case "txt_loginname"
                  If txt_loginname.Value = "" Then
                        strSearchField = "(samAccountName=*)"
                  Else
                              strSearchField = "(samAccountName=*" & txt_loginname.Value & "*)"
                        End If
            Case "txt_email"
                  If txt_email.Value = "" Then
                        strSearchField = "(mail=*)"
                  Else
                              strSearchField = "(mail=*" & txt_email.Value & "*)"
                        End If
            Case "txt_empid"
                  If txt_empid.Value = "" Then
                        strSearchField = "(description=*)"
                  Else
                              strSearchField = "(description=*" & txt_empid.Value & "*)"
                        End If
            Case "txt_designation"
                  If txt_designation.Value = "" Then
                        strSearchField = "(title=*)"
                  Else
                              strSearchField = "(title=*" & txt_designation.Value & "*)"
                        End If
            Case "txt_extensionno"
                  If txt_extensionno.Value = "" Then
                        strSearchField = "(telephoneNumber=*)"
                  Else
                              strSearchField = "(telephoneNumber=*" & txt_extensionno.Value & "*)"
                        End If
            Case "txt_mobileno"
                  If txt_mobileno.Value = "" Then
                        strSearchField = "(mobile=*)"
                  Else
                              strSearchField = "(mobile=*" & txt_mobileno.Value & "*)"
                        End If
            Case "txt_notes"
                  If txt_notes.Value = "" Then
                        strSearchField = "(info=*)"
                  Else
                              strSearchField = "(info=*" & txt_notes.Value & "*)"
                        End If
            Case "txt_department"
                  If txt_department.Value = "" Then
                        strSearchField = "(department=*)"
                  Else
                              strSearchField = "(department=*" & txt_department.Value & "*)"
                        End If
            Case Else
                  strSearchField = "INVALID"
      End Select
 
      Clear_Form
      
      If strSearchField <> "INVALID" Then
            Set adoCommand = CreateObject("ADODB.Command")
            Set adoConnection = CreateObject("ADODB.Connection")
            adoConnection.Provider = "ADsDSOObject"
            adoConnection.Open "Active Directory Provider"
            adoCommand.ActiveConnection = adoConnection
            
             ' Search entire Active Directory domain.
            Set objRootDSE = GetObject("LDAP://RootDSE")
            
            strDNSDomain = objRootDSE.Get("defaultNamingContext")
            strBase = "<LDAP://" & strDNSDomain & ">"
            
            strFilter = "(&(objectCategory=person)(objectClass=user)" & strSearchField & ")"
            'strFilter = "(&(objectClass=computer)(cn=" & strComputer & "))"
            
            ' Comma delimited list of attribute values to retrieve.
            strAttributes = "cn,samAccountName,mail,description,Title,TelephoneNumber,Mobile,Info,Department"
            
            ' Construct the LDAP syntax query.
            strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
            adoCommand.CommandText = strQuery
            adoCommand.Properties("Page Size") = 100
            adoCommand.Properties("Timeout") = 30
            adoCommand.Properties("Cache Results") = False
            
            ' Run the query.
            Set adoRecordset = adoCommand.Execute
             
            ' Enumerate the resulting recordset.
            strDetails = ""
            If Not adoRecordset.EOF Then
                  Do Until adoRecordset.EOF
                        If strDetails = "" Then
                              strDetails = Replace(adoRecordset.Fields("cn").Value, "CN=", "") &_
                                                "|TD|" & adoRecordset.Fields("samAccountName").Value &_
                                                "|TD|" & adoRecordset.Fields("mail").Value
                                                If IsNull(adoRecordset.Fields("Description").Value) = False Then
                                                      strDetails = strDetails & "|TD|" & Join(adoRecordset.Fields("description").Value)
                                                Else
                                                      strDetails = strDetails & "|TD|"
                                                End If
                                                strDetails = strDetails & "|TD|" & adoRecordset.Fields("Title").Value &_
                                                "|TD|" & adoRecordset.Fields("TelephoneNumber").Value &_
                                                "|TD|" & adoRecordset.Fields("Mobile").Value
                                                If IsNull(adoRecordset.Fields("Info").Value) = False Then
                                                      strDetails = strDetails & "|TD|" & Replace(adoRecordset.Fields("Info").Value, "Machine Name - ", "")
                                                Else
                                                      strDetails = strDetails & "|TD|"
                                                End If
                                                strDetails = strDetails & "|TD|" & adoRecordset.Fields("Department").Value
                        Else
                              strDetails = strDetails & "|TR|" & Replace(adoRecordset.Fields("cn").Value, "CN=", "") &_
                                                "|TD|" & adoRecordset.Fields("samAccountName").Value &_
                                                "|TD|" & adoRecordset.Fields("mail").Value
                                                If IsNull(adoRecordset.Fields("Description").Value) = False Then
                                                      strDetails = strDetails & "|TD|" & Join(adoRecordset.Fields("description").Value)
                                                Else
                                                      strDetails = strDetails & "|TD|"
                                                End If
                                                strDetails = strDetails & "|TD|" & adoRecordset.Fields("Title").Value &_
                                                "|TD|" & adoRecordset.Fields("TelephoneNumber").Value &_
                                                "|TD|" & adoRecordset.Fields("Mobile").Value
                                                If IsNull(adoRecordset.Fields("Info").Value) = False Then
                                                      strDetails = strDetails & "|TD|" & Replace(adoRecordset.Fields("Info").Value, "Machine Name - ", "")
                                                Else
                                                      strDetails = strDetails & "|TD|"
                                                End If
                                                strDetails = strDetails & "|TD|" & adoRecordset.Fields("Department").Value
                        End If
                      adoRecordset.MoveNext
                  Loop
            Else
                  MsgBox "No records were found"
            End If
            
            ' Clean up.
            adoRecordset.Close
            Set adoRecordset = Nothing
            
            adoConnection.Close
      
            If strDetails <> "" Then
                  arrRows = ""
                  arrRows = Split(strDetails, "|TR|")
                  If UBound(arrRows) < 0 Then
                        span_currentrecord.InnerHTML = "0"
                        span_totalrecords.InnerHTML = "0"
                  Else
                        arrData = Split(arrRows(0), "|TD|")
                        txt_name.Value = arrData(0)
                        txt_loginname.Value = arrData(1)
                        txt_email.Value = arrData(2)
                        txt_empid.Value = arrData(3)
                        txt_designation.Value = arrData(4)
                        txt_extensionno.Value = arrData(5)
                        txt_mobileno.Value = arrData(6)
                        txt_notes.Value = arrData(7)
                        txt_department.Value = arrData(8)
                        span_currentrecord.InnerHTML = "1"
                        span_totalrecords.InnerHTML = UBound(arrRows) + 1
                  End If
            Else
                  span_currentrecord.InnerHTML = "0"
                  span_totalrecords.InnerHTML = "0"
            End If
            If strDetails = "" Then
                  btnFirstEvent.Disabled = True
                  btnPreviousEvent.Disabled = True
                  btnNextEvent.Disabled = True
                  btnLastEvent.Disabled = True      
                  btnFirstEvent.Style.Visibility = "Hidden"
                  btnPreviousEvent.Style.Visibility = "Hidden"
                  btnNextEvent.Style.Visibility = "Hidden"
                  btnLastEvent.Style.Visibility = "Hidden"
            ElseIf UBound(arrRows) = 0 Then
                  btnFirstEvent.Disabled = True
                  btnPreviousEvent.Disabled = True
                  btnNextEvent.Disabled = True
                  btnLastEvent.Disabled = True
                  btnFirstEvent.Style.Visibility = "Hidden"
                  btnPreviousEvent.Style.Visibility = "Hidden"
                  btnNextEvent.Style.Visibility = "Hidden"
                  btnLastEvent.Style.Visibility = "Hidden"
            Else
                  btnFirstEvent.Disabled = False
                  btnPreviousEvent.Disabled = False
                  btnNextEvent.Disabled = False
                  btnLastEvent.Disabled = False
                  btnFirstEvent.Style.Visibility = "Visible"
                  btnPreviousEvent.Style.Visibility = "Visible"
                  btnNextEvent.Style.Visibility = "Visible"
                  btnLastEvent.Style.Visibility = "Visible"
            End If
      Else
            MsgBox "Please type a search request into one of the fields, then click Submit."
      End If
      
End Sub
 
Sub Get_Event
 
      arrData = Split(arrRows(span_currentrecord.InnerHTML - 1), "|TD|")
      txt_name.Value = arrData(0)
      txt_loginname.Value = arrData(1)
      txt_email.Value = arrData(2)
      txt_empid.Value = arrData(3)
      txt_designation.Value = arrData(4)
      txt_extensionno.Value = arrData(5)
      txt_mobileno.Value = arrData(6)
      txt_notes.Value = arrData(7)
      txt_department.Value = arrData(8)
 
End Sub
 
Sub First_Event
      
      If IsArray(arrRows) = False Then
            MsgBox "There are no records to display."
      Else
            If span_totalrecords.InnerHTML < 1 Then
                  MsgBox "There are no records to display"
            ElseIf span_currentrecord.InnerHTML = 1 Then
                  MsgBox "You are already viewing the first record."
            Else
                  span_currentrecord.InnerHTML = 1
                  Get_Event
            End If
      End If
      
End Sub
 
Sub Previous_Event
      
      If IsArray(arrRows) = False Then
            MsgBox "There are no records to display."
      Else
            If span_currentrecord.InnerHTML > 1 Then
                  span_currentrecord.InnerHTML = span_currentrecord.InnerHTML - 1
                  Get_Event
            ElseIf span_currentrecord.InnerHTML = 1 Then
                        MsgBox "You are already viewing the first record."
            Else
                  MsgBox "There are no records to display"
            End If
      End If
 
End Sub
 
Sub Next_Event
      
      If IsArray(arrRows) = False Then
            MsgBox "There are no records to display."
      Else
            If span_totalrecords.InnerHTML = 0 Then
                  MsgBox "There are no records for to display"
            ElseIf span_currentrecord.InnerHTML = span_totalrecords.InnerHTML Then
                  MsgBox "You are already viewing the last record."
            Else
                  span_currentrecord.InnerHTML = span_currentrecord.InnerHTML + 1
                  Get_Event
            End If
      End If
      
End Sub
 
Sub Last_Event
      
      If IsArray(arrRows) = False Then
            MsgBox "There are no records to display."
      Else
            If span_totalrecords.InnerHTML = 0 Then
                  MsgBox "There are no records to display"
            ElseIf span_currentrecord.InnerHTML = span_totalrecords.InnerHTML Then
                        MsgBox "You are already viewing the last record."
            Else
                  span_currentrecord.InnerHTML = span_totalrecords.InnerHTML
                  Get_Event
            End If
      End If
      
End Sub
 
Sub Detect_Search_Field(strCurrentField)
      arrFields = Array(_
            "txt_name", _
            "txt_loginname", _
            "txt_email", _
            "txt_empid", _
            "txt_designation", _
            "txt_extensionno", _
            "txt_mobileno", _
            "txt_notes", _
            "txt_department")
      
      For Each strField In arrFields
            If LCase(strField) <> LCase(strCurrentField) Then
                  Execute strField & ".style.backgroundColor=""#D3D3D3"""
                  Execute strField & ".Disabled = True"
            End If
      Next
End Sub
 
Sub RunScript
      strAnswer = window.prompt("Please enter the Location to save.", "C:\HTAResults.csv")
 
      If IsNull(strAnswer) Then
            Msgbox "You clicked the Cancel button"
      Else
            Set objFSO = CreateObject("Scripting.FileSystemObject")
            If objFSO.FileExists(strAnswer) = True Then
                  Set objFile = objFSO.OpenTextFile(strAnswer, 8, False)
            Else
                  Set objFile = objFSO.CreateTextFile(strAnswer, True)
                  objFile.Write """User Name"",""Login Name"",""Email Address"",""Emp ID"",""Designation"",""Extension"",""Mobile"",""Computer"",""Department"""
            End If
      
                  For intRow = LBound(arrRows) To UBound(arrRows)
                        arrData = Split(arrRows(intRow), "|TD|")
                  objFile.Write VbCrLf & """" & arrData(0) & """,""" & arrData(1) & """,""" & arrData(2) & """,""" & arrData(3) & _
                        """,""" & arrData(4) & """,""" & arrData(5) & """,""" & arrData(6) & """,""" & arrData(7) & """,""" & _
                        arrData(8) & """"
                  Next
            objFile.Close
            MsgBox "Saved."
      End If
End Sub
 
</script>
 
<body STYLE="font:14 pt arial; color:white;filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Buttons'>
      <table width='90%' height = '100%' align='center' border='0'>
            <tr>
                  <td align='center' colspan="2">
                        <h3>User Information</h3><br>
                  </td>
            </tr
            <tr>
                  <td align='center' colspan="2">
                        <table border="0">
                              <tr>
                                    <td>
                                          User Name:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="30" size="40" id="txt_name" name="txt_name" onkeypress="vbs:Detect_Search_Field('txt_name')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Login Name:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="30" size="40" id="txt_loginname" name="txt_loginname" onkeypress="vbs:Detect_Search_Field('txt_loginname')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Email Address:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="50" size="70" id="txt_email" name="txt_email" onkeypress="vbs:Detect_Search_Field('txt_email')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Emp ID:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="6" size="10" id="txt_empid" name="txt_empid" onkeypress="vbs:Detect_Search_Field('txt_empid')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Designation:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="50" size="70" id="txt_designation" name="txt_designation" onkeypress="vbs:Detect_Search_Field('txt_designation')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Extension No:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="25" size="40" id="txt_extensionno" name="txt_extensionno" onkeypress="vbs:Detect_Search_Field('txt_extensionno')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Mobile Number:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_mobileno" name="txt_mobileno" onkeypress="vbs:Detect_Search_Field('txt_mobileno')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                         Machine Name:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="16" size="20" id="txt_notes" name="txt_notes" onkeypress="vbs:Detect_Search_Field('txt_notes')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Department:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="30" size="50" id="txt_department" name="txt_department" onkeypress="vbs:Detect_Search_Field('txt_department')">
                                    </td>
                              </tr>
                              <tr>
                                    <td colspan="2" align="center">
                                          <br>Showing record&nbsp
                                          <span id="span_currentrecord">
                                          0
                                          </span>
                                          &nbspof&nbsp
                                          <span id="span_totalrecords">
                                          0
                                          </span>
                                          <br>
                                          <input type='button' value='||< First' name='btnFirstEvent'  onClick='vbs:First_Event'>&nbsp&nbsp&nbsp&nbsp&nbsp
                                          <input type='button' value='<< Previous' name='btnPreviousEvent'  onClick='vbs:Previous_Event'>&nbsp&nbsp&nbsp&nbsp&nbsp
                                          <input type='button' value='Next >>' name='btnNextEvent'  onClick='vbs:Next_Event'>&nbsp&nbsp&nbsp&nbsp&nbsp
                                          <input type='button' value='Last >||' name='btnLastEvent'  onClick='vbs:Last_Event'><br><br><br>
                                          <input type='button' value='Clear Form' name='btnClearForm'  onClick='vbs:Clear_Form'>
                                          <input type="button" value="Submit" name="btn_submit" onClick="vbs:Submit_Form">
                                <input id=runbutton  class="button" type="button" value="Save to" name="run_button"  onClick="Runscript">
                                    </td>
                              </tr>
                        </table>
                  </td>
            </tr>
      </table>
 </body>

Open in new window

Book1.xls
LVL 11
bsharathAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RobSampsonCommented:
Sharath, the HTA you have posted currently outputs in this order (but from left to right):

User Name
Login Name
Email Address
Emp ID
Designation
Extension
Mobile
Computer
Department

What order do you want it in?

Regards,

Rob.
0
bsharathAuthor Commented:
This order Rob..

Seat No
Ext No
Emp Id
Operational Dept
Designation
Name
NT Login
EMail Address
Machinename
Office
Mobile
Company
Address
City
State
Zipcode
Country
Home Phone

When click on save button it has to be saved in the colums as mentioned in the excel sheet. attached on the main post.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

bsharathAuthor Commented:
Reminder...
0
bsharathAuthor Commented:
Rob any help...
0
bsharathAuthor Commented:
0
bsharathAuthor Commented:
Rob any help on this...
0
RobSampsonCommented:
OK, this one will take a while.  Looking at it now, I didn't seem to write it very flexible....I'll try to look at it tomorrow.

Regards,

Rob.
0
bsharathAuthor Commented:
Ok Rob...
0
RobSampsonCommented:
Sharath, I'll work on this one for a while.....for the attributes you listed in post ID: 20794276, can you please clarify which Active Directory fields you are using for each attribute?

Rob.
0
bsharathAuthor Commented:
Rob here they are

Seat No              General > office
Ext No              General > Telephone No
Emp Id              Description
Operational Dept         Organization > department
Designation       >        Organization > title
Name    
NT Login
EMail Address
Machinename    > Notes
Office                  >  This can be remove. (Excluded)
Mobile
Company
Address
City
State
Zipcode
Country
Home Phone
0
bsharathAuthor Commented:
Rob here they are

Seat No              General > office
Ext No              General > Telephone No
Emp Id              Description
Operational Dept         Organization > department
Designation       >        Organization > title
Name    
NT Login
EMail Address
Machinename    > Notes
Office                  >  This can be remove. (Excluded)
Mobile
Company
Address
City
State
Zipcode
Country
Home Phone
0
RobSampsonCommented:
LOL!  OK, a few hours later....and time to go home for me....try this.....

Regards,

Rob.
<head>
<title>User Information</title>
<HTA:APPLICATION 
     APPLICATIONNAME="User Information"
     BORDER="thin"
     SCROLL="no"
     SINGLEINSTANCE="yes"
     WINDOWSTATE="normal"
>
</head>
 
<script language="VBScript">
 
' Global variables
Dim arrRows
 
Sub Window_OnLoad
      intWidth = 800
      intHeight = 800
      Me.ResizeTo intWidth, intHeight
      Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
      btnFirstEvent.Disabled = True
      btnPreviousEvent.Disabled = True
      btnNextEvent.Disabled = True
      btnLastEvent.Disabled = True
      btnFirstEvent.Style.Visibility = "Hidden"
      btnPreviousEvent.Style.Visibility = "Hidden"
      btnNextEvent.Style.Visibility = "Hidden"
      btnLastEvent.Style.Visibility = "Hidden"
End Sub
 
Sub Default_Buttons
      If Window.Event.KeyCode = 13 Then
            btn_submit.Click
      ElseIf Window.Event.KeyCode = 27 Then
            Clear_Form
      End If      
End Sub
 
Sub Clear_Form
      txt_seatno.Value = ""
      txt_seatno.style.backgroundColor="#FFFFFF"
      txt_seatno.Disabled = False
      txt_extensionno.Value = ""
      txt_extensionno.style.backgroundColor="#FFFFFF"
      txt_extensionno.Disabled = False
      txt_empid.Value = ""
      txt_empid.style.backgroundColor="#FFFFFF"
      txt_empid.Disabled = False
      txt_department.Value = ""
      txt_department.style.backgroundColor="#FFFFFF"
      txt_department.Disabled = False
      txt_designation.Value = ""
      txt_designation.style.backgroundColor="#FFFFFF"
      txt_designation.Disabled = False
      txt_name.Value = ""
      txt_name.style.backgroundColor="#FFFFFF"
      txt_name.Disabled = False
      txt_loginname.Value = ""
      txt_loginname.style.backgroundColor="#FFFFFF"
      txt_loginname.Disabled = False
      txt_email.Value = ""
      txt_email.style.backgroundColor="#FFFFFF"
      txt_email.Disabled = False
      txt_notes.Value = ""
      txt_notes.style.backgroundColor="#FFFFFF"
      txt_notes.Disabled = False
      txt_mobileno.Value = ""
      txt_mobileno.style.backgroundColor="#FFFFFF"
      txt_mobileno.Disabled = False
      txt_company.Value = ""
      txt_company.style.backgroundColor="#FFFFFF"
      txt_company.Disabled = False
      txt_address.Value = ""
      txt_address.style.backgroundColor="#FFFFFF"
      txt_address.Disabled = False
      txt_city.Value = ""
      txt_city.style.backgroundColor="#FFFFFF"
      txt_city.Disabled = False
      txt_state.Value = ""
      txt_state.style.backgroundColor="#FFFFFF"
      txt_state.Disabled = False
      txt_zipcode.Value = ""
      txt_zipcode.style.backgroundColor="#FFFFFF"
      txt_zipcode.Disabled = False
      txt_country.Value = ""
      txt_country.style.backgroundColor="#FFFFFF"
      txt_country.Disabled = False
      txt_homephone.Value = ""
      txt_homephone.style.backgroundColor="#FFFFFF"
      txt_homephone.Disabled = False
      btnFirstEvent.Style.Visibility = "Hidden"
      btnPreviousEvent.Style.Visibility = "Hidden"
      btnNextEvent.Style.Visibility = "Hidden"
      btnLastEvent.Style.Visibility = "Hidden"
      span_currentrecord.InnerHTML = "0"
      span_totalrecords.InnerHTML = "0"
End Sub
 
Sub Submit_Form
 
      arrFields = Array(_
      		"txt_seatno", _
            "txt_extensionno", _
            "txt_empid", _
            "txt_department", _
            "txt_designation", _
            "txt_name", _
            "txt_loginname", _
            "txt_email", _
            "txt_notes", _
            "txt_mobileno", _
            "txt_company", _
            "txt_address", _
            "txt_city", _
            "txt_state", _
            "txt_zipcode", _
            "txt_country", _
            "txt_homephone" _
      )
      
      boolValid = False
      For Each strField In arrFields
            If Eval(strField & ".Disabled") = True Then
                  boolValid = True
            End If
            If Eval(strField & ".Disabled") = False Then
                  strCurrentField = strField
            End If
      Next
      
      If boolValid = False Then strCurrentField = "INVALID"
      
      Select Case strCurrentField
            Case "txt_seatno"
                  If txt_seatno.Value = "" Then
                              strSearchField = "(physicalDeliveryOfficeName=*)"
                        Else
                              strSearchField = "(physicalDeliveryOfficeName=*" & txt_seat.Value & "*)"
                        End If
            Case "txt_extensionno"
                  If txt_extensionno.Value = "" Then
                        strSearchField = "(telephoneNumber=*)"
                  Else
                              strSearchField = "(telephoneNumber=*" & txt_extensionno.Value & "*)"
                        End If
            Case "txt_empid"
                  If txt_empid.Value = "" Then
                        strSearchField = "(description=*)"
                  Else
                              strSearchField = "(description=*" & txt_empid.Value & "*)"
                        End If
            Case "txt_department"
                  If txt_department.Value = "" Then
                        strSearchField = "(department=*)"
                  Else
                              strSearchField = "(department=*" & txt_department.Value & "*)"
                        End If
            Case "txt_designation"
                  If txt_designation.Value = "" Then
                        strSearchField = "(title=*)"
                  Else
                              strSearchField = "(title=*" & txt_designation.Value & "*)"
                        End If
            Case "txt_name"
                  If txt_name.Value = "" Then
                              strSearchField = "(cn=*)"
                        Else
                              strSearchField = "(cn=*" & txt_name.Value & "*)"
                        End If
            Case "txt_loginname"
                  If txt_loginname.Value = "" Then
                        strSearchField = "(samAccountName=*)"
                  Else
                              strSearchField = "(samAccountName=*" & txt_loginname.Value & "*)"
                        End If
            Case "txt_email"
                  If txt_email.Value = "" Then
                        strSearchField = "(mail=*)"
                  Else
                              strSearchField = "(mail=*" & txt_email.Value & "*)"
                        End If
            Case "txt_notes"
                  If txt_notes.Value = "" Then
                        strSearchField = "(info=*)"
                  Else
                              strSearchField = "(info=*" & txt_notes.Value & "*)"
                        End If
            Case "txt_mobileno"
                  If txt_mobileno.Value = "" Then
                        strSearchField = "(mobile=*)"
                  Else
                              strSearchField = "(mobile=*" & txt_mobileno.Value & "*)"
                        End If
            Case "txt_company"
                  If txt_company.Value = "" Then
                        strSearchField = "(mobile=*)"
                  Else
                              strSearchField = "(mobile=*" & txt_company.Value & "*)"
                        End If
            Case "txt_address"
                  If txt_address.Value = "" Then
                        strSearchField = "(mobile=*)"
                  Else
                              strSearchField = "(mobile=*" & txt_address.Value & "*)"
                        End If
            Case "txt_city"
                  If txt_city.Value = "" Then
                        strSearchField = "(mobile=*)"
                  Else
                              strSearchField = "(mobile=*" & txt_city.Value & "*)"
                        End If
            Case "txt_state"
                  If txt_state.Value = "" Then
                        strSearchField = "(mobile=*)"
                  Else
                              strSearchField = "(mobile=*" & txt_state.Value & "*)"
                        End If
            Case "txt_zipcode"
                  If txt_zipcode.Value = "" Then
                        strSearchField = "(mobile=*)"
                  Else
                              strSearchField = "(mobile=*" & txt_zipcode.Value & "*)"
                        End If
            Case "txt_country"
                  If txt_country.Value = "" Then
                        strSearchField = "(mobile=*)"
                  Else
                              strSearchField = "(mobile=*" & txt_country.Value & "*)"
                        End If
            Case "txt_homephone"
                  If txt_homephone.Value = "" Then
                        strSearchField = "(mobile=*)"
                  Else
                              strSearchField = "(mobile=*" & txt_homephone.Value & "*)"
                        End If
            Case Else
                  strSearchField = "INVALID"
      End Select
 
      Clear_Form
      
      If strSearchField <> "INVALID" Then
            Set adoCommand = CreateObject("ADODB.Command")
            Set adoConnection = CreateObject("ADODB.Connection")
            adoConnection.Provider = "ADsDSOObject"
            adoConnection.Open "Active Directory Provider"
            adoCommand.ActiveConnection = adoConnection
            
             ' Search entire Active Directory domain.
            Set objRootDSE = GetObject("LDAP://RootDSE")
            
            strDNSDomain = objRootDSE.Get("defaultNamingContext")
            strBase = "<LDAP://" & strDNSDomain & ">"
            
            strFilter = "(&(objectCategory=person)(objectClass=user)" & strSearchField & ")"
            'strFilter = "(&(objectClass=computer)(cn=" & strComputer & "))"
            
            ' Comma delimited list of attribute values to retrieve.
            strAttributes = "physicalDeliveryOfficeName,TelephoneNumber,description,Department,Title,cn,samAccountName,mail,Info,Mobile,company,streetAddress,l,st,postalCode,c,homePhone"
            
            ' Construct the LDAP syntax query.
            strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
            adoCommand.CommandText = strQuery
            adoCommand.Properties("Page Size") = 100
            adoCommand.Properties("Timeout") = 30
            adoCommand.Properties("Cache Results") = False
 
            ' Run the query.
            Set adoRecordset = adoCommand.Execute
             
            ' Enumerate the resulting recordset.
            strDetails = ""
            If Not adoRecordset.EOF Then
                  Do Until adoRecordset.EOF
                        If strDetails = "" Then
                              strDetails = adoRecordset.Fields("physicalDeliveryOfficeName").Value &_
                                                "|TD|" & adoRecordset.Fields("TelephoneNumber").Value
                                                If IsNull(adoRecordset.Fields("Description").Value) = False Then
                                                      strDetails = strDetails & "|TD|" & Join(adoRecordset.Fields("description").Value)
                                                Else
                                                      strDetails = strDetails & "|TD|"
                                                End If
                                                strDetails = strDetails & "|TD|" & adoRecordset.Fields("Title").Value &_
                                                "|TD|" & adoRecordset.Fields("Department").Value &_
                              					"|TD|" & Replace(adoRecordset.Fields("cn").Value, "CN=", "") &_
                                                "|TD|" & adoRecordset.Fields("samAccountName").Value &_
                                                "|TD|" & adoRecordset.Fields("mail").Value
                                                If IsNull(adoRecordset.Fields("Info").Value) = False Then
                                                      strDetails = strDetails & "|TD|" & Replace(adoRecordset.Fields("Info").Value, "Machine Name - ", "")
                                                Else
                                                      strDetails = strDetails & "|TD|"
                                                End If
                                                strDetails = strDetails & "|TD|" & adoRecordset.Fields("Mobile").Value &_
                                                "|TD|" & adoRecordset.Fields("company").Value &_
                                                "|TD|" & adoRecordset.Fields("streetAddress").Value &_
                                                "|TD|" & adoRecordset.Fields("l").Value &_
                                                "|TD|" & adoRecordset.Fields("st").Value &_
                                                "|TD|" & adoRecordset.Fields("postalCode").Value &_
                                                "|TD|" & adoRecordset.Fields("c").Value &_
                                                "|TD|" & adoRecordset.Fields("homePhone").Value
                        Else
                              strDetails = strDetails & "|TR|" & adoRecordset.Fields("physicalDeliveryOfficeName").Value &_
                                                "|TD|" & adoRecordset.Fields("TelephoneNumber").Value
                                                If IsNull(adoRecordset.Fields("Description").Value) = False Then
                                                      strDetails = strDetails & "|TD|" & Join(adoRecordset.Fields("description").Value)
                                                Else
                                                      strDetails = strDetails & "|TD|"
                                                End If
                                                strDetails = strDetails & "|TD|" & adoRecordset.Fields("Title").Value &_
                                                "|TD|" & adoRecordset.Fields("Department").Value &_
                              					"|TD|" & Replace(adoRecordset.Fields("cn").Value, "CN=", "") &_
                                                "|TD|" & adoRecordset.Fields("samAccountName").Value &_
                                                "|TD|" & adoRecordset.Fields("mail").Value
                                                If IsNull(adoRecordset.Fields("Info").Value) = False Then
                                                      strDetails = strDetails & "|TD|" & Replace(adoRecordset.Fields("Info").Value, "Machine Name - ", "")
                                                Else
                                                      strDetails = strDetails & "|TD|"
                                                End If
                                                strDetails = strDetails & "|TD|" & adoRecordset.Fields("Mobile").Value &_
                                                "|TD|" & adoRecordset.Fields("company").Value &_
                                                "|TD|" & adoRecordset.Fields("streetAddress").Value &_
                                                "|TD|" & adoRecordset.Fields("l").Value &_
                                                "|TD|" & adoRecordset.Fields("st").Value &_
                                                "|TD|" & adoRecordset.Fields("postalCode").Value &_
                                                "|TD|" & adoRecordset.Fields("c").Value &_
                                                "|TD|" & adoRecordset.Fields("homePhone").Value
                        End If
                      adoRecordset.MoveNext
                  Loop
            Else
                  MsgBox "No records were found"
            End If
            
            ' Clean up.
            adoRecordset.Close
            Set adoRecordset = Nothing
            
            adoConnection.Close
      
            If strDetails <> "" Then
                  arrRows = ""
                  arrRows = Split(strDetails, "|TR|")
                  If UBound(arrRows) < 0 Then
                        span_currentrecord.InnerHTML = "0"
                        span_totalrecords.InnerHTML = "0"
                  Else
                        arrData = Split(arrRows(0), "|TD|")
						txt_seatno.Value = arrData(0)
                        txt_extensionno.Value = arrData(1)
                        txt_empid.Value = arrData(2)
                        txt_department.Value = arrData(3)
                        txt_designation.Value = arrData(4)
                        txt_name.Value = arrData(5)
                        txt_loginname.Value = arrData(6)
                        txt_email.Value = arrData(7)
                        txt_notes.Value = arrData(8)
                        txt_mobileno.Value = arrData(9)
                        txt_company.Value = arrData(10)
                        txt_address.Value = arrData(11)
                        txt_city.Value = arrData(12)
                        txt_state.Value = arrData(13)
                        txt_zipcode.Value = arrData(14)
                        txt_country.Value = arrData(15)
                        txt_homephone.Value = arrData(16)
                        span_currentrecord.InnerHTML = "1"
                        span_totalrecords.InnerHTML = UBound(arrRows) + 1
                  End If
            Else
                  span_currentrecord.InnerHTML = "0"
                  span_totalrecords.InnerHTML = "0"
            End If
            If strDetails = "" Then
                  btnFirstEvent.Disabled = True
                  btnPreviousEvent.Disabled = True
                  btnNextEvent.Disabled = True
                  btnLastEvent.Disabled = True      
                  btnFirstEvent.Style.Visibility = "Hidden"
                  btnPreviousEvent.Style.Visibility = "Hidden"
                  btnNextEvent.Style.Visibility = "Hidden"
                  btnLastEvent.Style.Visibility = "Hidden"
            ElseIf UBound(arrRows) = 0 Then
                  btnFirstEvent.Disabled = True
                  btnPreviousEvent.Disabled = True
                  btnNextEvent.Disabled = True
                  btnLastEvent.Disabled = True
                  btnFirstEvent.Style.Visibility = "Hidden"
                  btnPreviousEvent.Style.Visibility = "Hidden"
                  btnNextEvent.Style.Visibility = "Hidden"
                  btnLastEvent.Style.Visibility = "Hidden"
            Else
                  btnFirstEvent.Disabled = False
                  btnPreviousEvent.Disabled = False
                  btnNextEvent.Disabled = False
                  btnLastEvent.Disabled = False
                  btnFirstEvent.Style.Visibility = "Visible"
                  btnPreviousEvent.Style.Visibility = "Visible"
                  btnNextEvent.Style.Visibility = "Visible"
                  btnLastEvent.Style.Visibility = "Visible"
            End If
      Else
            MsgBox "Please type a search request into one of the fields, then click Submit."
      End If
      
End Sub
 
Sub Get_Event
 
	arrData = Split(arrRows(span_currentrecord.InnerHTML - 1), "|TD|")
	txt_seatno.Value = arrData(0)
	txt_extensionno.Value = arrData(1)
	txt_empid.Value = arrData(2)
	txt_department.Value = arrData(3)
	txt_designation.Value = arrData(4)
	txt_name.Value = arrData(5)
	txt_loginname.Value = arrData(6)
	txt_email.Value = arrData(7)
	txt_notes.Value = arrData(8)
	txt_mobileno.Value = arrData(9)
	txt_company.Value = arrData(10)
	txt_address.Value = arrData(11)
	txt_city.Value = arrData(12)
	txt_state.Value = arrData(13)
	txt_zipcode.Value = arrData(14)
	txt_country.Value = arrData(15)
	txt_homephone.Value = arrData(16)
 
End Sub
 
Sub First_Event
      
      If IsArray(arrRows) = False Then
            MsgBox "There are no records to display."
      Else
            If span_totalrecords.InnerHTML < 1 Then
                  MsgBox "There are no records to display"
            ElseIf span_currentrecord.InnerHTML = 1 Then
                  MsgBox "You are already viewing the first record."
            Else
                  span_currentrecord.InnerHTML = 1
                  Get_Event
            End If
      End If
      
End Sub
 
Sub Previous_Event
      
      If IsArray(arrRows) = False Then
            MsgBox "There are no records to display."
      Else
            If span_currentrecord.InnerHTML > 1 Then
                  span_currentrecord.InnerHTML = span_currentrecord.InnerHTML - 1
                  Get_Event
            ElseIf span_currentrecord.InnerHTML = 1 Then
                        MsgBox "You are already viewing the first record."
            Else
                  MsgBox "There are no records to display"
            End If
      End If
 
End Sub
 
Sub Next_Event
      
      If IsArray(arrRows) = False Then
            MsgBox "There are no records to display."
      Else
            If span_totalrecords.InnerHTML = 0 Then
                  MsgBox "There are no records for to display"
            ElseIf span_currentrecord.InnerHTML = span_totalrecords.InnerHTML Then
                  MsgBox "You are already viewing the last record."
            Else
                  span_currentrecord.InnerHTML = span_currentrecord.InnerHTML + 1
                  Get_Event
            End If
      End If
      
End Sub
 
Sub Last_Event
      
      If IsArray(arrRows) = False Then
            MsgBox "There are no records to display."
      Else
            If span_totalrecords.InnerHTML = 0 Then
                  MsgBox "There are no records to display"
            ElseIf span_currentrecord.InnerHTML = span_totalrecords.InnerHTML Then
                        MsgBox "You are already viewing the last record."
            Else
                  span_currentrecord.InnerHTML = span_totalrecords.InnerHTML
                  Get_Event
            End If
      End If
      
End Sub
 
Sub Detect_Search_Field(strCurrentField)
      arrFields = Array(_
      		"txt_seatno", _
            "txt_extensionno", _
            "txt_empid", _
            "txt_department", _
            "txt_designation", _
            "txt_name", _
            "txt_loginname", _
            "txt_email", _
            "txt_notes", _
            "txt_mobileno", _
            "txt_company", _
            "txt_address", _
            "txt_city", _
            "txt_state", _
            "txt_zipcode", _
            "txt_country", _
            "txt_homephone" _
      )
      
      For Each strField In arrFields
            If LCase(strField) <> LCase(strCurrentField) Then
                  Execute strField & ".style.backgroundColor=""#D3D3D3"""
                  Execute strField & ".Disabled = True"
            End If
      Next
End Sub
 
Sub RunScript
      strAnswer = window.prompt("Please enter the Location to save.", "C:\HTAResults.csv")
 
      If IsNull(strAnswer) Then
            Msgbox "You clicked the Cancel button"
      Else
            Set objFSO = CreateObject("Scripting.FileSystemObject")
            If objFSO.FileExists(strAnswer) = True Then
                  Set objFile = objFSO.OpenTextFile(strAnswer, 8, False)
            Else
                  Set objFile = objFSO.CreateTextFile(strAnswer, True)
                  objFile.Write """Seat No"",""Extension"",""Emp ID"",""Department"",""Designation"",""User Name"",""Login Name"",""Email Address"",""Computer"",""Mobile"",""Company"",""Address"",""City"",""State"",""Zip Code"",""Country"",""Home Phone"""
            End If
      
                  For intRow = LBound(arrRows) To UBound(arrRows)
                        arrData = Split(arrRows(intRow), "|TD|")
                  objFile.Write VbCrLf & """" & arrData(0) & """,""" & arrData(1) & """,""" & arrData(2) & """,""" & arrData(3) & _
                        """,""" & arrData(4) & """,""" & arrData(5) & """,""" & arrData(6) & """,""" & arrData(7) & _
                        """,""" & arrData(8) & """,""" & arrData(9) & """,""" & arrData(10) & """,""" & arrData(11) & _
                        """,""" & arrData(12) & """,""" & arrData(13) & """,""" & arrData(14) & """,""" & arrData(15) & _
                        """,""" & arrData(16) & """"
                  Next
            objFile.Close
            MsgBox "Saved."
      End If
End Sub
 
</script>
 
<body STYLE="font:14 pt arial; color:white;filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Buttons'>
      <table width='90%' height = '100%' align='center' border='0'>
            <tr>
                  <td align='center' colspan="2">
                        <h3>User Information</h3><br>
                  </td>
            </tr
            <tr>
                  <td align='center' colspan="2">
                        <table border="0">
                              <tr>
                                    <td>
                                          Seat No:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="30" size="40" id="txt_seatno" name="txt_seatno" onkeypress="vbs:Detect_Search_Field('txt_seatno')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Extension No:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="25" size="40" id="txt_extensionno" name="txt_extensionno" onkeypress="vbs:Detect_Search_Field('txt_extensionno')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Emp ID:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="6" size="10" id="txt_empid" name="txt_empid" onkeypress="vbs:Detect_Search_Field('txt_empid')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Department:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="30" size="50" id="txt_department" name="txt_department" onkeypress="vbs:Detect_Search_Field('txt_department')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Designation:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="50" size="70" id="txt_designation" name="txt_designation" onkeypress="vbs:Detect_Search_Field('txt_designation')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          User Name:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="30" size="40" id="txt_name" name="txt_name" onkeypress="vbs:Detect_Search_Field('txt_name')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Login Name:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="30" size="40" id="txt_loginname" name="txt_loginname" onkeypress="vbs:Detect_Search_Field('txt_loginname')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Email Address:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="50" size="70" id="txt_email" name="txt_email" onkeypress="vbs:Detect_Search_Field('txt_email')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                         Machine Name:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="16" size="20" id="txt_notes" name="txt_notes" onkeypress="vbs:Detect_Search_Field('txt_notes')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Mobile Number:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_mobileno" name="txt_mobileno" onkeypress="vbs:Detect_Search_Field('txt_mobileno')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Company:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_company" name="txt_company" onkeypress="vbs:Detect_Search_Field('txt_company')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Address:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_address" name="txt_address" onkeypress="vbs:Detect_Search_Field('txt_address')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          City:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_city" name="txt_city" onkeypress="vbs:Detect_Search_Field('txt_city')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          State:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_state" name="txt_state" onkeypress="vbs:Detect_Search_Field('txt_state')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Zip Code:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_zipcode" name="txt_zipcode" onkeypress="vbs:Detect_Search_Field('txt_zipcode')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Country:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_country" name="txt_country" onkeypress="vbs:Detect_Search_Field('txt_country')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Home Phone:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_homephone" name="txt_homephone" onkeypress="vbs:Detect_Search_Field('txt_homephone')">
                                    </td>
                              </tr>
                              <tr>
                                    <td colspan="2" align="center">
                                          <br>Showing record&nbsp
                                          <span id="span_currentrecord">
                                          0
                                          </span>
                                          &nbspof&nbsp
                                          <span id="span_totalrecords">
                                          0
                                          </span>
                                          <br>
                                          <input type='button' value='||< First' name='btnFirstEvent'  onClick='vbs:First_Event'>&nbsp&nbsp&nbsp&nbsp&nbsp
                                          <input type='button' value='<< Previous' name='btnPreviousEvent'  onClick='vbs:Previous_Event'>&nbsp&nbsp&nbsp&nbsp&nbsp
                                          <input type='button' value='Next >>' name='btnNextEvent'  onClick='vbs:Next_Event'>&nbsp&nbsp&nbsp&nbsp&nbsp
                                          <input type='button' value='Last >||' name='btnLastEvent'  onClick='vbs:Last_Event'><br><br><br>
                                          <input type='button' value='Clear Form' name='btnClearForm'  onClick='vbs:Clear_Form'>
                                          <input type="button" value="Submit" name="btn_submit" onClick="vbs:Submit_Form">
                                <input id=runbutton  class="button" type="button" value="Save to" name="run_button"  onClick="Runscript">
                                    </td>
                              </tr>
                        </table>
                  </td>
            </tr>
      </table>
 </body>

Open in new window

0
bsharathAuthor Commented:
Rob thanks for this...Looks reat and works fine too.Except this error and the other image none of the input works for me.
Address,Company all these dont get the data.
ScreenShot013.bmp
ScreenShot014.bmp
0
RobSampsonCommented:
Sharath, sorry about that!  Wow, I've been busy today.....unfortunately I've run out of time this week.....I will really try to get to your posts next week, I know you're waiting.....

Regards,

Rob.
<head>
<title>User Information</title>
<HTA:APPLICATION 
     APPLICATIONNAME="User Information"
     BORDER="thin"
     SCROLL="no"
     SINGLEINSTANCE="yes"
     WINDOWSTATE="normal"
>
</head>
 
<script language="VBScript">
 
' Global variables
Dim arrRows
 
Sub Window_OnLoad
      intWidth = 800
      intHeight = 800
      Me.ResizeTo intWidth, intHeight
      Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
      btnFirstEvent.Disabled = True
      btnPreviousEvent.Disabled = True
      btnNextEvent.Disabled = True
      btnLastEvent.Disabled = True
      btnFirstEvent.Style.Visibility = "Hidden"
      btnPreviousEvent.Style.Visibility = "Hidden"
      btnNextEvent.Style.Visibility = "Hidden"
      btnLastEvent.Style.Visibility = "Hidden"
End Sub
 
Sub Default_Buttons
      If Window.Event.KeyCode = 13 Then
            btn_submit.Click
      ElseIf Window.Event.KeyCode = 27 Then
            Clear_Form
      End If      
End Sub
 
Sub Clear_Form
      txt_seatno.Value = ""
      txt_seatno.style.backgroundColor="#FFFFFF"
      txt_seatno.Disabled = False
      txt_extensionno.Value = ""
      txt_extensionno.style.backgroundColor="#FFFFFF"
      txt_extensionno.Disabled = False
      txt_empid.Value = ""
      txt_empid.style.backgroundColor="#FFFFFF"
      txt_empid.Disabled = False
      txt_department.Value = ""
      txt_department.style.backgroundColor="#FFFFFF"
      txt_department.Disabled = False
      txt_designation.Value = ""
      txt_designation.style.backgroundColor="#FFFFFF"
      txt_designation.Disabled = False
      txt_name.Value = ""
      txt_name.style.backgroundColor="#FFFFFF"
      txt_name.Disabled = False
      txt_loginname.Value = ""
      txt_loginname.style.backgroundColor="#FFFFFF"
      txt_loginname.Disabled = False
      txt_email.Value = ""
      txt_email.style.backgroundColor="#FFFFFF"
      txt_email.Disabled = False
      txt_notes.Value = ""
      txt_notes.style.backgroundColor="#FFFFFF"
      txt_notes.Disabled = False
      txt_mobileno.Value = ""
      txt_mobileno.style.backgroundColor="#FFFFFF"
      txt_mobileno.Disabled = False
      txt_company.Value = ""
      txt_company.style.backgroundColor="#FFFFFF"
      txt_company.Disabled = False
      txt_address.Value = ""
      txt_address.style.backgroundColor="#FFFFFF"
      txt_address.Disabled = False
      txt_city.Value = ""
      txt_city.style.backgroundColor="#FFFFFF"
      txt_city.Disabled = False
      txt_state.Value = ""
      txt_state.style.backgroundColor="#FFFFFF"
      txt_state.Disabled = False
      txt_zipcode.Value = ""
      txt_zipcode.style.backgroundColor="#FFFFFF"
      txt_zipcode.Disabled = False
      txt_country.Value = ""
      txt_country.style.backgroundColor="#FFFFFF"
      txt_country.Disabled = False
      txt_homephone.Value = ""
      txt_homephone.style.backgroundColor="#FFFFFF"
      txt_homephone.Disabled = False
      btnFirstEvent.Style.Visibility = "Hidden"
      btnPreviousEvent.Style.Visibility = "Hidden"
      btnNextEvent.Style.Visibility = "Hidden"
      btnLastEvent.Style.Visibility = "Hidden"
      span_currentrecord.InnerHTML = "0"
      span_totalrecords.InnerHTML = "0"
End Sub
 
Sub Submit_Form
 
      arrFields = Array(_
      		"txt_seatno", _
            "txt_extensionno", _
            "txt_empid", _
            "txt_department", _
            "txt_designation", _
            "txt_name", _
            "txt_loginname", _
            "txt_email", _
            "txt_notes", _
            "txt_mobileno", _
            "txt_company", _
            "txt_address", _
            "txt_city", _
            "txt_state", _
            "txt_zipcode", _
            "txt_country", _
            "txt_homephone" _
      )
      
      boolValid = False
      For Each strField In arrFields
            If Eval(strField & ".Disabled") = True Then
                  boolValid = True
            End If
            If Eval(strField & ".Disabled") = False Then
                  strCurrentField = strField
            End If
      Next
      
      If boolValid = False Then strCurrentField = "INVALID"
      
      Select Case strCurrentField
            Case "txt_seatno"
                  If txt_seatno.Value = "" Then
                              strSearchField = "(physicalDeliveryOfficeName=*)"
                        Else
                              strSearchField = "(physicalDeliveryOfficeName=*" & txt_seatno.Value & "*)"
                        End If
            Case "txt_extensionno"
                  If txt_extensionno.Value = "" Then
                        strSearchField = "(telephoneNumber=*)"
                  Else
                              strSearchField = "(telephoneNumber=*" & txt_extensionno.Value & "*)"
                        End If
            Case "txt_empid"
                  If txt_empid.Value = "" Then
                        strSearchField = "(description=*)"
                  Else
                              strSearchField = "(description=*" & txt_empid.Value & "*)"
                        End If
            Case "txt_department"
                  If txt_department.Value = "" Then
                        strSearchField = "(department=*)"
                  Else
                              strSearchField = "(department=*" & txt_department.Value & "*)"
                        End If
            Case "txt_designation"
                  If txt_designation.Value = "" Then
                        strSearchField = "(title=*)"
                  Else
                              strSearchField = "(title=*" & txt_designation.Value & "*)"
                        End If
            Case "txt_name"
                  If txt_name.Value = "" Then
                              strSearchField = "(cn=*)"
                        Else
                              strSearchField = "(cn=*" & txt_name.Value & "*)"
                        End If
            Case "txt_loginname"
                  If txt_loginname.Value = "" Then
                        strSearchField = "(samAccountName=*)"
                  Else
                              strSearchField = "(samAccountName=*" & txt_loginname.Value & "*)"
                        End If
            Case "txt_email"
                  If txt_email.Value = "" Then
                        strSearchField = "(mail=*)"
                  Else
                              strSearchField = "(mail=*" & txt_email.Value & "*)"
                        End If
            Case "txt_notes"
                  If txt_notes.Value = "" Then
                        strSearchField = "(info=*)"
                  Else
                              strSearchField = "(info=*" & txt_notes.Value & "*)"
                        End If
            Case "txt_mobileno"
                  If txt_mobileno.Value = "" Then
                        strSearchField = "(mobile=*)"
                  Else
                              strSearchField = "(mobile=*" & txt_mobileno.Value & "*)"
                        End If
            Case "txt_company"
                  If txt_company.Value = "" Then
                        strSearchField = "(company=*)"
                  Else
                              strSearchField = "(company=*" & txt_company.Value & "*)"
                        End If
            Case "txt_address"
                  If txt_address.Value = "" Then
                        strSearchField = "(streetAddress=*)"
                  Else
                              strSearchField = "(streetAddress=*" & txt_address.Value & "*)"
                        End If
            Case "txt_city"
                  If txt_city.Value = "" Then
                        strSearchField = "(l=*)"
                  Else
                              strSearchField = "(l=*" & txt_city.Value & "*)"
                        End If
            Case "txt_state"
                  If txt_state.Value = "" Then
                        strSearchField = "(st=*)"
                  Else
                              strSearchField = "(st=*" & txt_state.Value & "*)"
                        End If
            Case "txt_zipcode"
                  If txt_zipcode.Value = "" Then
                        strSearchField = "(postalCode=*)"
                  Else
                              strSearchField = "(postalCode=*" & txt_zipcode.Value & "*)"
                        End If
            Case "txt_country"
                  If txt_country.Value = "" Then
                        strSearchField = "(c=*)"
                  Else
                              strSearchField = "(c=*" & txt_country.Value & "*)"
                        End If
            Case "txt_homephone"
                  If txt_homephone.Value = "" Then
                        strSearchField = "(homePhone=*)"
                  Else
                              strSearchField = "(homePhone=*" & txt_homephone.Value & "*)"
                        End If
            Case Else
                  strSearchField = "INVALID"
      End Select
 
      Clear_Form
      
      If strSearchField <> "INVALID" Then
            Set adoCommand = CreateObject("ADODB.Command")
            Set adoConnection = CreateObject("ADODB.Connection")
            adoConnection.Provider = "ADsDSOObject"
            adoConnection.Open "Active Directory Provider"
            adoCommand.ActiveConnection = adoConnection
            
             ' Search entire Active Directory domain.
            Set objRootDSE = GetObject("LDAP://RootDSE")
            
            strDNSDomain = objRootDSE.Get("defaultNamingContext")
            strBase = "<LDAP://" & strDNSDomain & ">"
            
            strFilter = "(&(objectCategory=person)(objectClass=user)" & strSearchField & ")"
            'strFilter = "(&(objectClass=computer)(cn=" & strComputer & "))"
            
            ' Comma delimited list of attribute values to retrieve.
            strAttributes = "physicalDeliveryOfficeName,TelephoneNumber,description,Department,Title,cn,samAccountName,mail,Info,Mobile,company,streetAddress,l,st,postalCode,c,homePhone"
            
            ' Construct the LDAP syntax query.
            strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
            adoCommand.CommandText = strQuery
            adoCommand.Properties("Page Size") = 100
            adoCommand.Properties("Timeout") = 30
            adoCommand.Properties("Cache Results") = False
 
            ' Run the query.
            Set adoRecordset = adoCommand.Execute
             
            ' Enumerate the resulting recordset.
            strDetails = ""
            If Not adoRecordset.EOF Then
                  Do Until adoRecordset.EOF
                        If strDetails = "" Then
                              strDetails = adoRecordset.Fields("physicalDeliveryOfficeName").Value &_
                                                "|TD|" & adoRecordset.Fields("TelephoneNumber").Value
                                                If IsNull(adoRecordset.Fields("Description").Value) = False Then
                                                      strDetails = strDetails & "|TD|" & Join(adoRecordset.Fields("description").Value)
                                                Else
                                                      strDetails = strDetails & "|TD|"
                                                End If
                                                strDetails = strDetails & "|TD|" & adoRecordset.Fields("Title").Value &_
                                                "|TD|" & adoRecordset.Fields("Department").Value &_
                              					"|TD|" & Replace(adoRecordset.Fields("cn").Value, "CN=", "") &_
                                                "|TD|" & adoRecordset.Fields("samAccountName").Value &_
                                                "|TD|" & adoRecordset.Fields("mail").Value
                                                If IsNull(adoRecordset.Fields("Info").Value) = False Then
                                                      strDetails = strDetails & "|TD|" & Replace(adoRecordset.Fields("Info").Value, "Machine Name - ", "")
                                                Else
                                                      strDetails = strDetails & "|TD|"
                                                End If
                                                strDetails = strDetails & "|TD|" & adoRecordset.Fields("Mobile").Value &_
                                                "|TD|" & adoRecordset.Fields("company").Value &_
                                                "|TD|" & adoRecordset.Fields("streetAddress").Value &_
                                                "|TD|" & adoRecordset.Fields("l").Value &_
                                                "|TD|" & adoRecordset.Fields("st").Value &_
                                                "|TD|" & adoRecordset.Fields("postalCode").Value &_
                                                "|TD|" & adoRecordset.Fields("c").Value &_
                                                "|TD|" & adoRecordset.Fields("homePhone").Value
                        Else
                              strDetails = strDetails & "|TR|" & adoRecordset.Fields("physicalDeliveryOfficeName").Value &_
                                                "|TD|" & adoRecordset.Fields("TelephoneNumber").Value
                                                If IsNull(adoRecordset.Fields("Description").Value) = False Then
                                                      strDetails = strDetails & "|TD|" & Join(adoRecordset.Fields("description").Value)
                                                Else
                                                      strDetails = strDetails & "|TD|"
                                                End If
                                                strDetails = strDetails & "|TD|" & adoRecordset.Fields("Title").Value &_
                                                "|TD|" & adoRecordset.Fields("Department").Value &_
                              					"|TD|" & Replace(adoRecordset.Fields("cn").Value, "CN=", "") &_
                                                "|TD|" & adoRecordset.Fields("samAccountName").Value &_
                                                "|TD|" & adoRecordset.Fields("mail").Value
                                                If IsNull(adoRecordset.Fields("Info").Value) = False Then
                                                      strDetails = strDetails & "|TD|" & Replace(adoRecordset.Fields("Info").Value, "Machine Name - ", "")
                                                Else
                                                      strDetails = strDetails & "|TD|"
                                                End If
                                                strDetails = strDetails & "|TD|" & adoRecordset.Fields("Mobile").Value &_
                                                "|TD|" & adoRecordset.Fields("company").Value &_
                                                "|TD|" & adoRecordset.Fields("streetAddress").Value &_
                                                "|TD|" & adoRecordset.Fields("l").Value &_
                                                "|TD|" & adoRecordset.Fields("st").Value &_
                                                "|TD|" & adoRecordset.Fields("postalCode").Value &_
                                                "|TD|" & adoRecordset.Fields("c").Value &_
                                                "|TD|" & adoRecordset.Fields("homePhone").Value
                        End If
                      adoRecordset.MoveNext
                  Loop
            Else
                  MsgBox "No records were found"
            End If
            
            ' Clean up.
            adoRecordset.Close
            Set adoRecordset = Nothing
            
            adoConnection.Close
      
            If strDetails <> "" Then
                  arrRows = ""
                  arrRows = Split(strDetails, "|TR|")
                  If UBound(arrRows) < 0 Then
                        span_currentrecord.InnerHTML = "0"
                        span_totalrecords.InnerHTML = "0"
                  Else
                        arrData = Split(arrRows(0), "|TD|")
						txt_seatno.Value = arrData(0)
                        txt_extensionno.Value = arrData(1)
                        txt_empid.Value = arrData(2)
                        txt_department.Value = arrData(3)
                        txt_designation.Value = arrData(4)
                        txt_name.Value = arrData(5)
                        txt_loginname.Value = arrData(6)
                        txt_email.Value = arrData(7)
                        txt_notes.Value = arrData(8)
                        txt_mobileno.Value = arrData(9)
                        txt_company.Value = arrData(10)
                        txt_address.Value = arrData(11)
                        txt_city.Value = arrData(12)
                        txt_state.Value = arrData(13)
                        txt_zipcode.Value = arrData(14)
                        txt_country.Value = arrData(15)
                        txt_homephone.Value = arrData(16)
                        span_currentrecord.InnerHTML = "1"
                        span_totalrecords.InnerHTML = UBound(arrRows) + 1
                  End If
            Else
                  span_currentrecord.InnerHTML = "0"
                  span_totalrecords.InnerHTML = "0"
            End If
            If strDetails = "" Then
                  btnFirstEvent.Disabled = True
                  btnPreviousEvent.Disabled = True
                  btnNextEvent.Disabled = True
                  btnLastEvent.Disabled = True      
                  btnFirstEvent.Style.Visibility = "Hidden"
                  btnPreviousEvent.Style.Visibility = "Hidden"
                  btnNextEvent.Style.Visibility = "Hidden"
                  btnLastEvent.Style.Visibility = "Hidden"
            ElseIf UBound(arrRows) = 0 Then
                  btnFirstEvent.Disabled = True
                  btnPreviousEvent.Disabled = True
                  btnNextEvent.Disabled = True
                  btnLastEvent.Disabled = True
                  btnFirstEvent.Style.Visibility = "Hidden"
                  btnPreviousEvent.Style.Visibility = "Hidden"
                  btnNextEvent.Style.Visibility = "Hidden"
                  btnLastEvent.Style.Visibility = "Hidden"
            Else
                  btnFirstEvent.Disabled = False
                  btnPreviousEvent.Disabled = False
                  btnNextEvent.Disabled = False
                  btnLastEvent.Disabled = False
                  btnFirstEvent.Style.Visibility = "Visible"
                  btnPreviousEvent.Style.Visibility = "Visible"
                  btnNextEvent.Style.Visibility = "Visible"
                  btnLastEvent.Style.Visibility = "Visible"
            End If
      Else
            MsgBox "Please type a search request into one of the fields, then click Submit."
      End If
      
End Sub
 
Sub Get_Event
 
	arrData = Split(arrRows(span_currentrecord.InnerHTML - 1), "|TD|")
	txt_seatno.Value = arrData(0)
	txt_extensionno.Value = arrData(1)
	txt_empid.Value = arrData(2)
	txt_department.Value = arrData(3)
	txt_designation.Value = arrData(4)
	txt_name.Value = arrData(5)
	txt_loginname.Value = arrData(6)
	txt_email.Value = arrData(7)
	txt_notes.Value = arrData(8)
	txt_mobileno.Value = arrData(9)
	txt_company.Value = arrData(10)
	txt_address.Value = arrData(11)
	txt_city.Value = arrData(12)
	txt_state.Value = arrData(13)
	txt_zipcode.Value = arrData(14)
	txt_country.Value = arrData(15)
	txt_homephone.Value = arrData(16)
 
End Sub
 
Sub First_Event
      
      If IsArray(arrRows) = False Then
            MsgBox "There are no records to display."
      Else
            If span_totalrecords.InnerHTML < 1 Then
                  MsgBox "There are no records to display"
            ElseIf span_currentrecord.InnerHTML = 1 Then
                  MsgBox "You are already viewing the first record."
            Else
                  span_currentrecord.InnerHTML = 1
                  Get_Event
            End If
      End If
      
End Sub
 
Sub Previous_Event
      
      If IsArray(arrRows) = False Then
            MsgBox "There are no records to display."
      Else
            If span_currentrecord.InnerHTML > 1 Then
                  span_currentrecord.InnerHTML = span_currentrecord.InnerHTML - 1
                  Get_Event
            ElseIf span_currentrecord.InnerHTML = 1 Then
                        MsgBox "You are already viewing the first record."
            Else
                  MsgBox "There are no records to display"
            End If
      End If
 
End Sub
 
Sub Next_Event
      
      If IsArray(arrRows) = False Then
            MsgBox "There are no records to display."
      Else
            If span_totalrecords.InnerHTML = 0 Then
                  MsgBox "There are no records for to display"
            ElseIf span_currentrecord.InnerHTML = span_totalrecords.InnerHTML Then
                  MsgBox "You are already viewing the last record."
            Else
                  span_currentrecord.InnerHTML = span_currentrecord.InnerHTML + 1
                  Get_Event
            End If
      End If
      
End Sub
 
Sub Last_Event
      
      If IsArray(arrRows) = False Then
            MsgBox "There are no records to display."
      Else
            If span_totalrecords.InnerHTML = 0 Then
                  MsgBox "There are no records to display"
            ElseIf span_currentrecord.InnerHTML = span_totalrecords.InnerHTML Then
                        MsgBox "You are already viewing the last record."
            Else
                  span_currentrecord.InnerHTML = span_totalrecords.InnerHTML
                  Get_Event
            End If
      End If
      
End Sub
 
Sub Detect_Search_Field(strCurrentField)
      arrFields = Array(_
      		"txt_seatno", _
            "txt_extensionno", _
            "txt_empid", _
            "txt_department", _
            "txt_designation", _
            "txt_name", _
            "txt_loginname", _
            "txt_email", _
            "txt_notes", _
            "txt_mobileno", _
            "txt_company", _
            "txt_address", _
            "txt_city", _
            "txt_state", _
            "txt_zipcode", _
            "txt_country", _
            "txt_homephone" _
      )
      
      For Each strField In arrFields
            If LCase(strField) <> LCase(strCurrentField) Then
                  Execute strField & ".style.backgroundColor=""#D3D3D3"""
                  Execute strField & ".Disabled = True"
            End If
      Next
End Sub
 
Sub RunScript
      strAnswer = window.prompt("Please enter the Location to save.", "C:\HTAResults.csv")
 
      If IsNull(strAnswer) Then
            Msgbox "You clicked the Cancel button"
      Else
            Set objFSO = CreateObject("Scripting.FileSystemObject")
            If objFSO.FileExists(strAnswer) = True Then
                  Set objFile = objFSO.OpenTextFile(strAnswer, 8, False)
            Else
                  Set objFile = objFSO.CreateTextFile(strAnswer, True)
                  objFile.Write """Seat No"",""Extension"",""Emp ID"",""Department"",""Designation"",""User Name"",""Login Name"",""Email Address"",""Computer"",""Mobile"",""Company"",""Address"",""City"",""State"",""Zip Code"",""Country"",""Home Phone"""
            End If
      
                  For intRow = LBound(arrRows) To UBound(arrRows)
                        arrData = Split(arrRows(intRow), "|TD|")
                  objFile.Write VbCrLf & """" & arrData(0) & """,""" & arrData(1) & """,""" & arrData(2) & """,""" & arrData(3) & _
                        """,""" & arrData(4) & """,""" & arrData(5) & """,""" & arrData(6) & """,""" & arrData(7) & _
                        """,""" & arrData(8) & """,""" & arrData(9) & """,""" & arrData(10) & """,""" & arrData(11) & _
                        """,""" & arrData(12) & """,""" & arrData(13) & """,""" & arrData(14) & """,""" & arrData(15) & _
                        """,""" & arrData(16) & """"
                  Next
            objFile.Close
            MsgBox "Saved."
      End If
End Sub
 
</script>
 
<body STYLE="font:14 pt arial; color:white;filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Buttons'>
      <table width='90%' height = '100%' align='center' border='0'>
            <tr>
                  <td align='center' colspan="2">
                        <h3>User Information</h3><br>
                  </td>
            </tr
            <tr>
                  <td align='center' colspan="2">
                        <table border="0">
                              <tr>
                                    <td>
                                          Seat No:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="30" size="40" id="txt_seatno" name="txt_seatno" onkeypress="vbs:Detect_Search_Field('txt_seatno')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Extension No:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="25" size="40" id="txt_extensionno" name="txt_extensionno" onkeypress="vbs:Detect_Search_Field('txt_extensionno')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Emp ID:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="6" size="10" id="txt_empid" name="txt_empid" onkeypress="vbs:Detect_Search_Field('txt_empid')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Department:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="30" size="50" id="txt_department" name="txt_department" onkeypress="vbs:Detect_Search_Field('txt_department')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Designation:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="50" size="70" id="txt_designation" name="txt_designation" onkeypress="vbs:Detect_Search_Field('txt_designation')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          User Name:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="30" size="40" id="txt_name" name="txt_name" onkeypress="vbs:Detect_Search_Field('txt_name')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Login Name:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="30" size="40" id="txt_loginname" name="txt_loginname" onkeypress="vbs:Detect_Search_Field('txt_loginname')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Email Address:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="50" size="70" id="txt_email" name="txt_email" onkeypress="vbs:Detect_Search_Field('txt_email')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                         Machine Name:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="16" size="20" id="txt_notes" name="txt_notes" onkeypress="vbs:Detect_Search_Field('txt_notes')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Mobile Number:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_mobileno" name="txt_mobileno" onkeypress="vbs:Detect_Search_Field('txt_mobileno')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Company:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_company" name="txt_company" onkeypress="vbs:Detect_Search_Field('txt_company')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Address:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_address" name="txt_address" onkeypress="vbs:Detect_Search_Field('txt_address')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          City:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_city" name="txt_city" onkeypress="vbs:Detect_Search_Field('txt_city')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          State:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_state" name="txt_state" onkeypress="vbs:Detect_Search_Field('txt_state')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Zip Code:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_zipcode" name="txt_zipcode" onkeypress="vbs:Detect_Search_Field('txt_zipcode')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Country:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_country" name="txt_country" onkeypress="vbs:Detect_Search_Field('txt_country')">
                                          &nbsp&nbspMust search by 2 letter country code
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Home Phone:
                                    </td>
                                    <td>
                                          <input type="text" maxlength="14" size="20" id="txt_homephone" name="txt_homephone" onkeypress="vbs:Detect_Search_Field('txt_homephone')">
                                    </td>
                              </tr>
                              <tr>
                                    <td colspan="2" align="center">
                                          <br>Showing record&nbsp
                                          <span id="span_currentrecord">
                                          0
                                          </span>
                                          &nbspof&nbsp
                                          <span id="span_totalrecords">
                                          0
                                          </span>
                                          <br>
                                          <input type='button' value='||< First' name='btnFirstEvent'  onClick='vbs:First_Event'>&nbsp&nbsp&nbsp&nbsp&nbsp
                                          <input type='button' value='<< Previous' name='btnPreviousEvent'  onClick='vbs:Previous_Event'>&nbsp&nbsp&nbsp&nbsp&nbsp
                                          <input type='button' value='Next >>' name='btnNextEvent'  onClick='vbs:Next_Event'>&nbsp&nbsp&nbsp&nbsp&nbsp
                                          <input type='button' value='Last >||' name='btnLastEvent'  onClick='vbs:Last_Event'><br><br><br>
                                          <input type='button' value='Clear Form' name='btnClearForm'  onClick='vbs:Clear_Form'>
                                          <input type="button" value="Submit" name="btn_submit" onClick="vbs:Submit_Form">
                                <input id=runbutton  class="button" type="button" value="Save to" name="run_button"  onClick="Runscript">
                                    </td>
                              </tr>
                        </table>
                  </td>
            </tr>
      </table>
 </body>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bsharathAuthor Commented:
Yes Rob..I have been waiting for your solutions....
Every day morning just monitoring my mailbox if i can see a mail from EE by you....

Thanks shall wait till Monday....
0
bsharathAuthor Commented:
Thanks Rob.... Its an Awsome hta file...
0
bsharathAuthor Commented:
Rob any help on my posts today... :-(
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.