Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Disappearing Data?

Discussion in 'Information Technology' started by Sharkbyte, Jul 28, 2006.

  1. Sharkbyte

    Sharkbyte
    Expand Collapse
    Guest

    I am using a query to build the dataset for a report. When I begin the code
    below, the query works fine. After I exit the loop, the query doesn't work.
    I assume it has something to do with the Update queries, but any ideas on how
    to overcome the issue?

    I believe this is enough code to see what is going on. Let me know if you
    need to see more.

    Thanks, in advance.

    Sharkbyte


    With Rst1
    .MoveFirst
    Do Until .EOF
    gblSupplier = Rst1!alternateshipvia
    MyStatus = Rst1!ItemID
    gblItemID = MyStatus
    gblCostPlus = DLookup("freight", "inventory...
    gblCost = DLookup("discprice", "tblsalesorderdetails...
    MyQty = Rst1!Quantity

    DoCmd.RunSQL ("update tblpolinedistributionlocal ...

    DoCmd.OpenForm "subfrmfillbackorders2", , , , , acDialog

    DoCmd.RunSQL ("update tblpolinedistributionlocal...
    DoCmd.RunSQL ("UPDATE tblSalesOrderDetails...
    DoCmd.RunSQL ("insert into tblfulfillbackorderslocal...
    DoCmd.RunSQL ("update tblbackorders...

    .MoveNext
    Loop
    End With

    DoCmd.OpenReport "rptfillbackorders2", acViewPreview, , , acDialog
     
  2. Loading...


  3. strive4peace

    strive4peace
    Expand Collapse
    Guest

    Hi Sharkbyte

    you are not refreshing your tables...

    currentdb.tabledefs.refresh
    DoEvents

    you may need to do this between each step so that each
    statement sees all the changes so far

    Warm Regards,
    Crystal
    Microsoft Access MVP 2006

    *
    Have an awesome day ;)

    remote programming and training
    strive4peace2006 at yahoo.com

    *

    Sharkbyte wrote:
    > I am using a query to build the dataset for a report. When I begin the code
    > below, the query works fine. After I exit the loop, the query doesn't work.
    > I assume it has something to do with the Update queries, but any ideas on how
    > to overcome the issue?
    >
    > I believe this is enough code to see what is going on. Let me know if you
    > need to see more.
    >
    > Thanks, in advance.
    >
    > Sharkbyte
    >
    >
    > With Rst1
    > .MoveFirst
    > Do Until .EOF
    > gblSupplier = Rst1!alternateshipvia
    > MyStatus = Rst1!ItemID
    > gblItemID = MyStatus
    > gblCostPlus = DLookup("freight", "inventory...
    > gblCost = DLookup("discprice", "tblsalesorderdetails...
    > MyQty = Rst1!Quantity
    >
    > DoCmd.RunSQL ("update tblpolinedistributionlocal ...
    >
    > DoCmd.OpenForm "subfrmfillbackorders2", , , , , acDialog
    >
    > DoCmd.RunSQL ("update tblpolinedistributionlocal...
    > DoCmd.RunSQL ("UPDATE tblSalesOrderDetails...
    > DoCmd.RunSQL ("insert into tblfulfillbackorderslocal...
    > DoCmd.RunSQL ("update tblbackorders...
    >
    > .MoveNext
    > Loop
    > End With
    >
    > DoCmd.OpenReport "rptfillbackorders2", acViewPreview, , , acDialog
     

Share This Page