J
John
Hello. I have a mainform (Purchase Orders) and a subform
(zPurchaseOrderItems). I am using the code below to determine if the
items in the subform match the projectid of the default charge acct.
The msgboxes are used for when building the routine to see where it
goes. The first msgbox does show the appropriate projectid. But in
the ElseIf line I get the problem. It seems that the ElseIf is not
being looked at. Even if I hardcode the projectid into the line in
place of the sql_po_approved(0) it still skips over it. Is the
referencing of the subform correct? Is this the way to go about
getting the info?
Dim sql_po_approved As ADODB.Recordset
Dim sql_po As String
Set conn = New ADODB.Connection
conn.Open "Driver={SQL Server};Server=test-
mxsql-02;Database=MTXMain;User ID=sa;Password=h0rn3t;" 'need to change
the server back to MXSQL before production
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)
If Me.DefaultChargeAccount.column(2) = sql_po_approved(0)
Then
MsgBox "made it to the if - they are the same on general
tab"
ElseIf Forms![Purchase Orders]!zPurchaseOrderItems.Form!
ChargeAccountID.column(3) = sql_po_approved(0) Then
MsgBox "made it to the elseif - they are the same on the
items tab"
Else
MsgBox "made it to the else - neither are the same"
End If
Thanks...John
(zPurchaseOrderItems). I am using the code below to determine if the
items in the subform match the projectid of the default charge acct.
The msgboxes are used for when building the routine to see where it
goes. The first msgbox does show the appropriate projectid. But in
the ElseIf line I get the problem. It seems that the ElseIf is not
being looked at. Even if I hardcode the projectid into the line in
place of the sql_po_approved(0) it still skips over it. Is the
referencing of the subform correct? Is this the way to go about
getting the info?
Dim sql_po_approved As ADODB.Recordset
Dim sql_po As String
Set conn = New ADODB.Connection
conn.Open "Driver={SQL Server};Server=test-
mxsql-02;Database=MTXMain;User ID=sa;Password=h0rn3t;" 'need to change
the server back to MXSQL before production
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)
If Me.DefaultChargeAccount.column(2) = sql_po_approved(0)
Then
MsgBox "made it to the if - they are the same on general
tab"
ElseIf Forms![Purchase Orders]!zPurchaseOrderItems.Form!
ChargeAccountID.column(3) = sql_po_approved(0) Then
MsgBox "made it to the elseif - they are the same on the
items tab"
Else
MsgBox "made it to the else - neither are the same"
End If
Thanks...John