Problem with relationships between 2 tables/ queries

Just the DoCmd.RunCommand acCmdSaveRecord part? or the whole thing starting from private sub - end sub
 
I got it.. just the one line! Great... it works! yeah!!!!!!!! Question.. someone mentioned about my data base needs to be compiled. Where do i find to do that?
 
i'm not sure what they're talking about Pam. I think Craig was the one that put it together, wasn't he?
 
To clarify, I only helped debug some of the issues Pam was having with a particular task she was wanting to achieve. I did NOT build this db.

But yes, Adam is right about the cause of the error.
You could also have alternatively used the line of code

Me.Dirty = False near the start of the command button code to force the record to be saved.


The compile error can be seen if you open a form in design view, then open the vba editor to look at some of your code. There's a menu called Debug, in the vba editor. The top item in that menu is the Compile option. This essentially runs through all your vba code looking for potential bugs and errors that might cause your db to have a hissyfit.

For example, a failure to compile will ruin any attempt to convert your Mdb file into a MDe file for distribution.

In this case, there is a letter 'p' in the code module outside of any of the subs or functions that should not be there.

Hope that explains that.
 
It does, and thank you both so much for helping me clear some of these problems up!!!!
 
I got it.. just the one line! Great... it works! yeah!!!!!!!! Question.. someone mentioned about my data base needs to be compiled. Where do i find to do that?

May I ask what exactly it was that you did to resolve this? I have a similar issue.
 
msrookie, what was your problem exactly? not sure i understand, other than you said similar issue.
 
msrookie, what was your problem exactly? not sure i understand, other than you said similar issue.

I want to prevent a user from leaving an input form without first saving the record. I have (at present), declared the form to be Modal, but would prefer another solution that saves the data (or at least asks the user to save the data via msgbox), if the form is changed without being closed (loss of focus?).
 
msrookie, add "DoCmd.RunCommand acCmdSaveRecord " in front of code on your close command .. should force a save before closing. i added it to a Command button that opened a form, right before the code that opened form and it works great. see earlier post from ajetrumpet.
 
msrookie, add "DoCmd.RunCommand acCmdSaveRecord " in front of code on your close command .. should force a save before closing. i added it to a Command button that opened a form, right before the code that opened form and it works great. see earlier post from ajetrumpet.

Ok, I put this code in and realized that a user could enter the form, and then lose focus without changing anything. This is not likely, but it might happen. What happens then, a blank record?
 
i am not sure, you could test it and see, i havent run into that. I would assume a blank record, but not positive, and you wouldnt want blank records in there
 
If your form is in data entry mode, and the user doesn't type anything into it, then no new record is created in the table.

A record is only created when the user types something or changes the state of a bound option/check box etc. However, the record is not saved to the table until the form closes, or the user moves to a new record, or if some code is triggered that explictly forces the record to be saved to the table (as in the example above)

Hopefully that helps clear up your confusion. :)
 

Users who are viewing this thread

Back
Top Bottom