Newbie Question on command buttons

My interpretation:

open a recordset from a query
Set rsQuery = dbs.OpenRecordset("qryStaffMonthlyPayroll", dbOpenDynaset)

Do While Not rsQuery.EOF < until no more records, set these fields to these form control values...

(Field = me.control)
dtStaffDoB = Me.StaffDateofBirth
sngBasicSalary = Nz(Me.BasicSalary, 0)

or are they just variables for which we don't see any declaration??

then set a bunch of form fields to what look like values returned from functions
e.g. Me.txtTotalAllowances = CalculateAllowances
interspersed with setting what look like variables to expressions and form controls to variables

On top of that, each time the code loops, the variables will change values but the variables a never used, and even if they were, it would be outside of the loop. Perhaps the called functions use those variables and those variables are public, which would explain why they're not shown as being declared.

You are correct that form controls are being set to recordset (?) values, but for the ones I listed at the top of this post, at first I thought it's the other way around. Now I think they're variavbles. So maybe what I thought was an attempt to edit a recordset field is something else all together.

The code is lacking something - either notation to remove the confusion or a complete re-write. It might be prudent to point out at this time that the confusion we have will be experienced by the writer in the future; say six months from now when it needs to be reviewed or tweaked. Sooner or later, the writer will be just as stumped because of the lack of documentation.
 
Hi All, I want to thank you all for your help. I said, from day 1, that I must've been doing something stupid, and teue to form, I was. Thanks to Microns detailed question and answer message, I went back to my code and worked out what I'd been doing wrong. Basically, rather than work with the underlying data directly, I'd been trying to manipulate the data from the controls on the form. (I told you I was stupid).
Anyway, I rewrote everything using the recordset and edited the data through that and just added a requery for the form at the end and, whala!!! It works!!!!
So, once again thank you all sooooo much. It was worth the joining fee. Oh sorry, unbelievably this is all FREE!!! Amazing!!!!
Thanks again
 
Who said it was free? When you joined, didn't you see the rule that says each solution costs you $10 per post. So my last post was #20, thus $10 x 20 = $200 USD.
I take PayPal :)
Seriously, I'm just glad you got it solved and that for once, I had something to do with it!
If you want to have your current code solution reviewed, just post it here.

P.S. you're not stupid. When I first started, I asked someone how to create a message box. 😱
 
Last edited by a moderator:

Users who are viewing this thread

Back
Top Bottom