Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2009
    Posts
    185

    Question Unanswered: Form_AfterdelConfirm and update table.

    I have a Planes table and a flights table. The Planes table has number of flights . If a user deletes a flights record I need to reduce the planes.iFlights field. I been around in circles on after I go Planes.iFlights=planes.iFlights-1 what do I need to do if anything to ensure that new iflights number is updated to the Planes table.

  2. #2
    Join Date
    Jul 2009
    Posts
    185

    Question

    This appears to be working but my ilocbatteryID which a Dim statement in load_form seems to be getting trashed some where by the delete function. At what poiint in a delete does the data record get cleared. Why would it affect a global variable? At least I think it is global.

    strSQL = "Update Battery Set [ibTotalCycles] =battery.[ibtotalcycles]-1 WHERE abID =" & ilocbatteryid
    Debug.Print "strSQL =" & strSQL
    DoCmd.SetWarnings False
    DoCmd****nSQL strSQL
    DoCmd.SetWarnings True

  3. #3
    Join Date
    Jul 2009
    Posts
    185
    I now have in Module main Public ilocbatteryid as Integer and that seems to be working now. I need to rename it though maybe iglobatteryID which is now done

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Why not just count the flights instead of tracking "iFlights" in a field?
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Jul 2009
    Posts
    185
    I have tried Dcount which seems to work. It is mainly two things, how to do this for when dcount doesn't work and for reporting not having to try and do a dcount all the time.

    Now to figure out why the following debug give a need object error but the strSQL update works find?
    Debug.Print "Form_AfterDelConfirm Battery.ibtotalcycles=" & Battery.[ibTotalCycles]

    strSQL = "Update Battery Set [ibTotalCycles] =battery.[ibtotalcycles]-1 WHERE abID =" & igloBatteryID
    Debug.Print "strSQL =" & strSQL
    DoCmd.SetWarnings False
    DoCmd****nSQL strSQL
    DoCmd.SetWarnings True

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •