PDA

View Full Version : Solved: Queried Form entry overwrites 1st Table entry



thomaspatton
11-05-2007, 12:17 PM
AMO Database (http://h1.ripway.com/thomaspatton/AMODatabase.zip) <-- Download Link since it's too big to affix.


Having a problem with something and I can't figure out how to fix it. And before ya'll professional coders start ripping on my limited VBA skills, I know... everything COULD be more efficient and cleaner. I've been doing ALOT of reading on my own and I'm still learning damnit :nya:

Anyway, when I open INPUTfrmStudEdit it brings up data from tblClass.FYClass. - working as intended

I hit Submit, it pulls up frmStudEdit with the correct Students... the FIRST time only - NOT working as intended.

For some reason, even with the Form property set to query tblStudent for ONLY entries that match the FYClass entry from INPUTfrmStudEdit, it edits the very first entry in tblStudent.FYClass. I can't get it to stop doing this! It does the same thing between INPUTfrmStudAdd and frmStudAdd as well. Click back and forth between them a couple times and you'll see my "A" through "C" entries get updated unwillingly.

How do I get it to still pull the FYClass entry from INPUTfrm*** and pull up the frm*** with the correct entries WITHOUT it changing that first tblStudent entry?!?

And I reiterate, please don't just rewrite my code and tell me to insert it. That fixes my eating problem, but I still don't know how to fish afterwards...

OBP
11-06-2007, 02:46 AM
Thomas, I have got your version of the forms working, but I have also created a more common version where the Class Selection Form is a Mainform and the Student Form is a sub form on it.
Your original forms have the suffix 1 after their names.
I have also reduced it's size by Compacting & Repairing it.

thomaspatton
11-06-2007, 05:41 AM
I like the concept for the form. Having the class selection at the top of the edit form actually makes more sense anyway so multiple classes can be edited without having to traverse my monstrosity.

So, my problem was that I was replacing the uppermost data in tblStudent because I was using internal form queries versus accessing the same data from an outside query? Just wanna make sure that was the issue with my version of the form.

Also (2 part question), since you used the "recordset" options in your version, is that a better way to go than using the query method? If so, do you know of any good, basic-to-advanced, online(free) tutorials for using recordsets (ADO?). I've been teaching myself from VBA Programming for the Absolute Beginner-2nd Edition and it doesn't seem like it covers that in-depth enough to be of future help to me if I choose to use that path.

Thanks, once again OBP.

OBP
11-06-2007, 04:57 PM
I am not sure if it was the relationship, or the query that fixed it or the combination of both.
You do not have to learn VBA to do what I did with the Combo box. The ToolBox Combo Box Wizard does that fro you.
You can of course do your "Add" Students on the same form.
If you need any more help just drop me a Private mail or email.