continuous subform keeps going back to first record

Based on the code in the Form_AfterUpdate() event of the FSubAddFILESERVICEITEMS form it appears as though you wanted the CurntField variable to be a global public variable for that form since it throws a runtime error when the form is run.
 
and it is global in my version but i tried both ways. i mad it global when i tried running the bookmark on the afterupdate of the form, not the field. can be either way
 
Any chance you have a version of the db that does *not* have all of the extra code you put in tyo "correct" the problem? I would make it easier to troubleshoot; at least for me.
 
sure, give me like 5 mins, i will take it all out
 
Great! I'm still trying to learn as much as I can from what I have.
 
thank you for even trying. i know this is neither interesting or easy
 

Attachments

One thing I did notice is you Set Warnings False in the OnLoad event of the form. Not a good practice since this also stops *all* error messages. You can run action queries with CurrentDB.Execute and it will not display those Warnings you are trying to supress. I also cold not find where you Set Warnings True in that form as it is a global property that carries through to everything after it.
 
You do know that Access will save *all* Dirty records as soon as you try to leave the record or close the form, right?
 
To follow up on my Post #27:
CurrentDb().Execute YourSQLVariable, dbFailOnError
...would then require Error handling code which you do not seem to have.
 
You do know that Access will save *all* Dirty records as soon as you try to leave the record or close the form, right?

i know about switching from record to record, was thinking on close it probably does but i'm oc, so i did it in case. will take it out now))))
 
One thing I did notice is you Set Warnings False in the OnLoad event of the form. Not a good practice since this also stops *all* error messages. You can run action queries with CurrentDB.Execute and it will not display those Warnings you are trying to supress. I also cold not find where you Set Warnings True in that form as it is a global property that carries through to everything after it.

i never turn them back on, i turn them off for everything always, i like it that way for some reason, but as i work on the db i need them so i manually turn them on, then go back in the form and they're on and it's annoying. so i put it in every form to turn it off on load so that i can turn them on as i need to buyt they go right back off soon as i'm back to testing
 
To follow up on my Post #27:
CurrentDb().Execute YourSQLVariable, dbFailOnError
...would then require Error handling code which you do not seem to have.

i had it and delete it, i like the code as short as possible. this was a nip from the internet, i didn't understand what benefit it gives me so i deleted it

i know, there's so much wrong with my code, i learn what i can as i go but the more i learn the more i realize there's so much more
 
i had it and delete it, i like the code as short as possible. this was a nip from the internet, i didn't understand what benefit it gives me so i deleted it

in case it didn't come through, i understand that this is retarted, but that's why i did it so i wrote it))))
 
Hi

Instead of using "DoCmd.RunCommand acCmdSaveRecord", you may like to try using:
Code:
If Me.Dirty = True Then
    Me.Dirty = False
End If
I think this will save any changes without the form doing a requery.
 
thank you, i definitely didn't know this. what about recalculating some fields?
 
HI

what about recalculating some fields?

What do you need to know about them?

A control (textbox, combobox, calculated control, etc) can each be requeried like this
Code:
Me.NameOfControl.Requery
Also, take a look at Recalc in the help files.
 
i will tell you in 5 mins which line makes my subform requery, i thought it was requerying the controls, but i might be wrong. i found it last night, give me a fes
 
Code:
        updates Amounts
    DoCmd.RunSQL "UPDATE CLIENTFILESERVICES SET CLIENTFILESERVICES.TtlChargesAmount = IIf(IsNull(DSum('BAmount','CLIENTFILESERVICEITEMS','ClientFileServiceID=' & [CLIENTFILESERVICES].[ID])),0,DSum('BAmount','CLIENTFILESERVICEITEMS','ClientFileServiceID=' & [CLIENTFILESERVICES].[ID])) " & _
    ", CLIENTFILESERVICES.TtlLiabilityAmount = IIf(IsNull(DSum('LAmount','CLIENTFILESERVICEITEMS','ClientFileServiceID=' & [CLIENTFILESERVICES].[ID])),0,DSum('LAmount','CLIENTFILESERVICEITEMS','ClientFileServiceID=' & [CLIENTFILESERVICES].[ID])) " & _
    "WHERE (((CLIENTFILESERVICES.TtlChargesAmount) Is Null OR (CLIENTFILESERVICES.TtlChargesAmount)<>IIf(IsNull(DSum('BAmount','CLIENTFILESERVICEITEMS','ClientFileServiceID=' & [CLIENTFILESERVICES].[ID])),0,DSum('BAmount','CLIENTFILESERVICEITEMS','ClientFileServiceID=' & [CLIENTFILESERVICES].[ID]))) " & _
    "AND ((CLIENTFILESERVICES.MarkTtlUnlocked)=0)) OR (((CLIENTFILESERVICES.TtlLiabilityAmount) Is Null OR (CLIENTFILESERVICES.TtlLiabilityAmount)<>IIf(IsNull(DSum('LAmount','CLIENTFILESERVICEITEMS','ClientFileServiceID=' & [CLIENTFILESERVICES].[ID])),0,DSum('LAmount','CLIENTFILESERVICEITEMS','ClientFileServiceID=' & [CLIENTFILESERVICES].[ID]))) " & _
    "AND ((CLIENTFILESERVICES.MarkTtlUnlocked)=0));"




Forms!faddfile!FSubAddFILESERVICES!TtlOfBAmount.Requery
Forms!faddfile!FSubAddFILESERVICES!TtlOfLiability.Requery
Forms!faddfile!FSubAddFILESERVICES!TtlTtlOfBAmount.Requery
Forms!faddfile!FSubAddFILESERVICES!TtlTtlOfLiability.Requery

these 2 chunks make it requery. i think i understand why but don't know what to do. the first chunk updates some fields in the SUBFORM THAT MY SUBFORM IS NESTED INSIDE OF.

i'm running this code from
Forms!faddfile!FSubAddFILESERVICES!FSubAddFILESERVICEITEMS

and then it goes on to requery those fields so that the new numbers show up


so i understand why it's happening, just don't know how to get around it
 

Users who are viewing this thread

Back
Top Bottom