I have a union of two fields of the same table and save the union at same table. Now when I accessed it using the DAO it works fine, but when I tried to use the ADO it will not work. WHy? Cant ADO access a union query?
Private Sub Execute(myID as long)
Dim rst As New ADODB.Recordset
rst.Open "SELECT UnionCode.myID, UnionCode.myCode, TblStockBatch.BatchCode FROM UnionCode LEFT JOIN TblStockBatch ON UnionCode.StockID = TblStockBatch.StockID WHERE UnionCode.StockID=" & Val(myID), ADOcon, adOpenKeyset, adLockOptimistic
If rst.RecordCount > 0 Then
Me.txtBarcode.Text = rst!myCode
Me.txtBatchCode.Text = IIf(IsNull(rst!BatchCode), "", rst!BatchCode)
Me.txtBarcode.Text = ""
Me.txtBatchCode.Text = ""
Set rst = Nothing
Can I get help from here? Thank you so much in advance