refreshing a subbform with CURRFORM.UPDATE

Hi all. To workaround another problem I split a filterform in a main and subform. The main forms contain filter variables, when validating they call functions in the subform. The subform is a list of records. After the filterfunctions I want to call a CurrForm.UPDATE to refresh the records in the list when changing the filtervalues on the main form. Errors occur when entering a filter that results in no records, like: no records found within the filter, or: do you want to rename the record. I tried the timer funtion, but this doesn’t solve the problem. If I don’t use the CurrForm.UPDATE the same error occurs when activating the subform. Does anyone know a workaround for this?

Hi In general the only way to control a subform from a form by CAL code is to create functions on the subform that set filters; then declare the subform as a variable in the main form and call the subform functions passing the filter you want to apply as an argument. Hope that this is what you want[:D]

It should work fine. The story goes like this: You create a function in the subform. This function set filters on fields using parameters passed to it. After setting fitlers, u can use CurrForm.UPDATE in this function. The error u wrote usualy is returned by functino FIND, if u don’t read the value returned by this functinon. // This will bring up error message if no record found SalesLine.FIND('-'); // This will not bring up error message if no record found IF SalesLine.FIND('-') THEN;

Arthur, Either I don’t understand you, or it doesn’t work. I created functions in the subform that set filters on the source table of the subform. I call the functions when validating a filter variable in the main form. After calling the filtering functions, I call a function in the subform which should update the subform. examples: UpdateSubform() If find(’-’) then; or: UpdateSubform() If find(’-’) then currform.update; It goes fine, untill a filter is set that doesn’t leave any records in the filter. Navision goes into a loop, or it gives the error (There is no record … within the filter…) when activating the subform.

You should move these line to the end of the UpdateSubform() function: CurrForm.UPDATE; If FIND(’-’) THEN; // Do you need it ?? Do you use FIND function somewhere else in the text that puts filters?

Arthur, I made a simple example to try it again and it worked !? I guess I made to much customizations to the forms and something else is causing the error. I just can’t find what it is. I think I might build the form again. Thanx for helping. Maarten

Try using debugger to find out on which function it breakes :wink: … and post the results.

Tried the debugger. It stops at the CurrForm.UPDATE. That’s the ‘funny’ thing about it. I give up (for the meantime).


I’m just wondering if you ever found a solution for this?