Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Macro Loop

Status
Not open for further replies.

cydud3

IS-IT--Management
Dec 21, 2004
57
KE
I have a form with 2 textboxes with their contents calculated based on values from other textboxes from that form. In order to accomplish this, I used a macro with SetQuery. What I want to know is how can I make it so I click one button and it goes through every record of that form and runs the calculation. So basically, it goes -- calculate, next record, calculate, next record ---

I know what ya'll are gonna say: Step away from the macros :) Yeah I know but I'm not really good at VB so if somebody has a VB solution, I'd be happy to try it out. Thanks
 
Hi. Your end result eludes me. Are you looking for a sum or average? If so, maybe dsum works.

Alternatively, if VBA is your not your style, have you considered conditions in your macros?

Further, forgive me and all who else might reply, but vba takes only a small amount of time to get used to, at least to the point of doing what you want. More to master to be sure, but most solutions you can code in minutes.

ChaZ
 
Believe me, I really want to learn VBA that's why I'm reading a tutorial at this very moment. I'm not a real beginner at programming per se but I'm a beginner at VBA.

Anyway, those two calculations are quite simple. They're mostly [Form]![Form1]![txtbox1] * [Form]![Form1]![txtbox2] or something like that. I just want to make all records recalculate automatically at once.

I know in VBA this can be easily done. You might just need a For loop in there. But as I said, I'm not familiar with VBA syntax.
 
I now have migrated the calculations to VBA and it is activated by a button. So, now, what I basically need to do is:
Code:
For Each Record in Recordset
    call CalcAmount.Click()
Next Record

I don't know the syntax for this so this does not work. Any help would be appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top