needing to convert?

J

John

I have a mainform and a subform. I am running the following code
below from the mainform routine. But I found something interesting.
If I hardcode 80 in place of the sql_po_approved(0) it works. I added
several other textboxes and a msgbox to relay back the projectid.
Here is what the whole process looks like.

Dim sql_po_approved As ADODB.Recordset
Dim sql_po As String
Set conn = New ADODB.Connection
conn.Open "Driver={SQL
Server};Server=xxxx;Database=xxxx;User ID=xxxx;Password=xxxx;"
sql_po = "SELECT ProjectID FROM ChargeAccounts WHERE ID =
dbo.POGetChargeAccountID(" & PONumber & ")"
Set sql_po_approved = New ADODB.Recordset
sql_po_approved.Open sql_po, conn, adOpenKeyset,
adLockReadOnly

MsgBox sql_po_approved(0)

Me.Text146 = sql_po_approved(0)
Me.Text144 = Forms![Purchase Orders]!
zPurchaseOrderItems.Form!ChargeAccountID.column(3)

With Me.zPurchaseOrderItems.Form.RecordsetClone
If .RecordCount > 0 Then .MoveFirst
While Not .EOF
If
Me.zPurchaseOrderItems.Form.ChargeAccountID.column(3) <>
sql_po_approved(0) Then
MsgBox "there is a non-matching line item"
End If
.MoveNext
Wend
End With

I added a breakpoint at the first msgbox and stepped thru. The Msgbox
gives 80. Text146 shows 80. Text144 shows it as "80". Text144 is
showing what the column in the cbo is. In the table the projectid is
an int. If I hardcod 80 into the IF statement it works. I use
Text146 and get the no action. If I use Text144 I do not get the
msgbox inside the IF. Even if I change a line item in the subform
there is no action. Is there something else needed in the sql, dim,
set above? Should it be integer? How would that be changed? I am
puzzled.

Thanks.....John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top