Author Posts

May 18, 2016 at 10:13 am

I have an application that I build that enters Names into a .mdb table ( access 97 .mdb 🙁 )
What I want to do is as I am typing into the text box I want to populate the textbox with names that match from a different table/column. So for instance as I start typing I want all like entries to show up below the the text box and for each letter I enter the list get smaller and smaller till you can tab complete.

This is the code to access the database via Access Database Engine 2010 in powershell. In the table the column is Truck_ID that I want to check against.

  $adOpenStatic = 3
  $adLockOptimistic = 3

  $objConnection = New-Object -comobject ADODB.Connection
  $objRecordset = New-Object -comobject ADODB.Recordset

  $objConnection.Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source = c:\Database\Gen3Data.mdb")
  $objRecordset.Open("Select * from Trucks", $objConnection,$adOpenStatic,$adLockOptimistic)
  $objRecordset.Fields.Item("Truck_ID").value

Here is all the code
http://pastebin.com/50dumDnA

May 18, 2016 at 11:59 am

OK, So I assigned all the values from that column to a $truckID. Now this should be a easier way to make this a drop down box? That I can type and pick from whats available?

$adOpenStatic = 3
$adLockOptimistic = 3
$objConnection = New-Object -comobject ADODB.Connection
$objRecordset = New-Object -comobject ADODB.Recordset
$objConnection.Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source = c:\Database\Gen3Data.mdb")
$objRecordset.Open("Select Truck_ID from Trucks ", $objConnection,$adOpenStatic,$adLockOptimistic)
$objRecordset.Fields.Item()
$truckID = $objRecordset.GetRows() 
$objRecordset.Close()
$objConnection.Close()