locked
looping thru a continous subform RRS feed

  • Question

  • Hello.  I am trying to loop thru a continuous subform.  I have the code below that I have been using because the dbo in the select statement is a scalar function that returns the approved charge acct.  From that I can then get the approved project id, which is what I actually need.  The project id is an int in the sql server table.  In the subform is a txtbox (txtProjectID).  I need to go thru the continous subform list and find if any of the listed items do not match the what the approved project id is.  An example is if the approved charge acct number was 1234-04567.  In the charge acct table the project id would be 64.  It is 64 that the below code returns.  This 64 is now used to compare against the the txtProjectID textbox to see if any list items are different.  If there is, then it would set another process in motion.  If not, then the user can proceed on undisturbed.  I have a status (Approved) that this check is being done for.  I think only one pass thru is needed to see if there is a different projectid.  Can anyone review this to see how a loop would work using below code as I am really struggling with this and under the gun?   

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

    Thanks...John

    Monday, November 22, 2010 6:59 PM

Answers

  • Hello John,

    Thanks for posting. For continuous subform, this forum has lot issues about it. Please try to search it on Access forum, and see if this link could help you. If it does not help you, just feel free to follow up. Have a nice weekend.

    Best regards,
    Bessie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Proposed as answer by Bessie Zhao Tuesday, November 30, 2010 10:17 AM
    • Marked as answer by Bessie Zhao Friday, December 3, 2010 11:04 AM
    Friday, November 26, 2010 4:01 PM