A
anders.vestnes
Hey.
I'm working on a code where I am going to pick out a unknowed number of
strings from a database. In the code below I am geting onley one result
in the "rst!BomItemId" thoo it should hawe been a unknowned number
(more than 10). could some one help me with how you are extracting
multiple reults from a VBA select query?
Function TotalPrice()
Dim BomItemId As String
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strSQL As String
Dim ComponentOrderJobId As String
Dim buffer As String
ComponentOrderJobId =
Forms![frmComponentOrderProject]![ComponentOrderJobId]
strSQL = "SELECT [BomItemID] FROM [TblBomItems] " & _
"WHERE [ComponentOrderJobID] = " & _
ComponentOrderJobId & " ;"
Set cnn = CurrentProject.Connection
Set rst = New ADODB.Recordset
rst.Open strSQL, cnn, adOpenForwardOnly, adLockReadOnly
buffer = rst!BomItemId
cnn.Close
'Then some more code....
End Function
I'm working on a code where I am going to pick out a unknowed number of
strings from a database. In the code below I am geting onley one result
in the "rst!BomItemId" thoo it should hawe been a unknowned number
(more than 10). could some one help me with how you are extracting
multiple reults from a VBA select query?
Function TotalPrice()
Dim BomItemId As String
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strSQL As String
Dim ComponentOrderJobId As String
Dim buffer As String
ComponentOrderJobId =
Forms![frmComponentOrderProject]![ComponentOrderJobId]
strSQL = "SELECT [BomItemID] FROM [TblBomItems] " & _
"WHERE [ComponentOrderJobID] = " & _
ComponentOrderJobId & " ;"
Set cnn = CurrentProject.Connection
Set rst = New ADODB.Recordset
rst.Open strSQL, cnn, adOpenForwardOnly, adLockReadOnly
buffer = rst!BomItemId
cnn.Close
'Then some more code....
End Function