Hi, Currently I am having an issue with vb to vba conversion, since there are no itemdata properties or anything like that. I need to have underlying values for my combobox to insert into a database, but also be able to call application.calculatefull after the insertion for various UDFs on the spreadsheet. The code I am trying to conver is here
this is just to load my order entry screen, but I cannot figure out how to do underlying values in comboboxes in vba. Like I said before, if I can just pass the excel object to VB, I should be able to do it from there. Anyone have any ideas?
Code:
Private Sub Form_Load()
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\tradeview\Tradelog.mdb;"
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "select futsymbol, ID from futuresdata", db, adOpenStatic, adLockOptimistic
varrecords = adoPrimaryRS.GetRows(adoPrimaryRS.RecordCount)
For x = 0 To adoPrimaryRS.RecordCount - 1
If varrecords(0, x) <> "" Then CommBox.List(x) = varrecords(0, x)
If varrecords(1, x) <> "" Then CommBox.ItemData(x) = varrecords(1, x)
Next x
Set adoPrimaryRS = Nothing
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "select Name, ID from system order by name", db, adOpenStatic, adLockOptimistic
varrecords = adoPrimaryRS.GetRows(adoPrimaryRS.RecordCount)
For x = 0 To adoPrimaryRS.RecordCount - 1
If varrecords(0, x) <> "" Then
SystemBox.List(x) = varrecords(0, x)
If varrecords(1, x) <> "" Then SystemBox.ItemData(x) = varrecords(1, x)
End If
Next x
Set adoPrimaryRS = Nothing
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "select AccountName, AccountNO from accounts", db, adOpenStatic, adLockOptimistic
If adoPrimaryRS.RecordCount > 0 Then varrecords = adoPrimaryRS.GetRows(adoPrimaryRS.RecordCount)
For x = 0 To adoPrimaryRS.RecordCount - 1
If varrecords(0, x) <> "" Then AccountBox.List(x) = varrecords(0, x)
If varrecords(1, x) <> "" Then AccountBox.ItemData(x) = varrecords(1, x)
Next x
Set adoPrimaryRS = Nothing
End Sub
this is just to load my order entry screen, but I cannot figure out how to do underlying values in comboboxes in vba. Like I said before, if I can just pass the excel object to VB, I should be able to do it from there. Anyone have any ideas?