Thanks, Banana....
Like many rank novices, I've leapt over the most basic things, done some stuff that works, but find myself at a loss over the simplest things.
I can create a query that pulls the data I want and make it the RecordSource for my form. This query, built with the wizard, is not updatable. If I make it updatable, it's no longer available in the list of potential RecordSources. If I update it after it's the RecordSource, I get errors when I try to do anything at all.
Looking back, that's likely why I ended up using my tables instead of queries as RecordSource in the first place.
I confess it also doesn't makes sense to me that an updatable query protects data more than just using a table.
After spending hours reading messages on this forum, reading help screens, looking at databases so much more complicated than mine that I can barely tell where (or if) they're relevant to my current problem, I'm at the point where I'd just like to know how to make the dang form perform the calculations, when looking at an existing record, as it does with a new record.
New records do just what I want. (By the way, all my problems are with calculated controls, not stored data from fields.) Existing records, I have to click on certain controls to invoke the calcs. That's doable, but no user wants to take that trouble. Placing the same calculation codes elsewhere, in an attempt to get them to run when I pull up an old record not only doesn't work, but subtly corrupts the database till it calculates things incorrectly and I have to delete it and go back to another copy of a functional one. (I learned long before working with databases to work on a copy, only.)
So, it's frustrating.
For example, I have the following event procedure on Exit of control Alternate Fee:
If Me!txtCoinsurance > 0 Then
If Not IsNull(Me!txtAlternate_Fee) Then
Me!txtTherapy_Total = Me!txtAlternate_Fee
Else
Me!txtTherapy_Total = (Me!txtTherapy_SubTotal * (Me!txtCoinsurance / 100)) + Nz(Me!txtCopay, 0)
End If
Else
If Not IsNull(Me!txtAlternate_Fee) Then
Me!txtTherapy_Total = Me!txtAlternate_Fee
Else
Me!txtTherapy_Total = Me!txtTherapy_SubTotal + Nz(Me!txtCopay, 0)
End If
End If
This works fine. It checks to see if a coinsurance exists, if an alternate fee exists and if a copay exists and then comes up with the amount an insured patient actually owes for the visit.
If I put that same code into OnGotFocus of the control that gets the focus when a record is displayed, it does nothing. And that is not because of controls being empty, I have it check the contents of another control that has an autonumber if it's an existing record before it runs.
If I define that same code as a Function and call it, instead of writing it out (in the 2 places where it needs to be) it works for a while and then starts giving incorrect amounts. I have no idea why. Deleting all records and performing a Repair and Compact doesn't fix it. Time to delete and start with a new copy.
<whine whine>
So, if you or anyone can either suggest place to run calcs (like the one above) when an old record is pulled up OR give simple generic steps on how to use a query as RecordSource and still be able to create new records, I'd appreciate it, to say the least.