View Full Version : Header to detail tab code issue


DseHarmon
08-12-2007, 03:27 PM
I have made a small text box in the header area, as to be able to tab from the header area to the detail area, and put the code Me.[Date
Sold].SetFocus (Date Sold being the name of the text box I would like to tab
to) in the "Got Focus" event. However for some reason it does not work, I
get an "Invalid outside procedure" error every time.

Any advice on how to fix this problem would be most welcome.

RuralGuy
08-12-2007, 04:34 PM
Something else is going on because I just tested it and it works just as you would expect. What version of Access are you using?

DseHarmon
08-12-2007, 07:07 PM
I have found 1 error and fixed it and that was I had a left over fragment of code in my VBA editor, and that removed the error message but for some reason the "code box" as it were is not changing focus to the "Date Sold" box its keeping focus on itself. Oh and I am using the 2007 version.

Any ideas on what would cause that?

RuralGuy
08-12-2007, 11:42 PM
Sorry but as I said, what you have done in the GotFocus event of a control in the Header of the form I tested in ac2K2 and it works just fine. I would think it would work in ac2007 as well. Is there any other code in that event?

DseHarmon
08-13-2007, 07:58 AM
This is what my entire VBA editor looks like;

Option Compare Database


Private Sub txtTransferToDetail_GotFocus()
Me.[Date Sold].SetFocus
End Sub

RuralGuy
08-13-2007, 08:04 AM
It should work. Have you tried a /decompile (http://www.granite.ab.ca/access/decompile.htm) yet? How about Compact and Repair. Importing everything into a new, empty db?

DseHarmon
08-13-2007, 08:17 AM
How do you run a decompile and Compact and Repair?

I will try the importing.

DseHarmon
08-13-2007, 08:23 AM
I think I might just love you, that importing for whatever reason, worked! I have had this problem for 4 days and dealt with over fifteen people all trying to solve it over that 4 day period and you walk in and in less than 24 hours have it fixed.

Yes I love you.

DseHarmon
08-13-2007, 08:42 AM
Just when I thought it was all fixed I have hit a new issue, it works perfect on Access 2007 but when I convert it to 2003 it no longer works...

RuralGuy
08-13-2007, 09:02 AM
The link I supplied shows you how to do the undocumented "/decompile" and Tools>Database Utilities>Compact And Repair Database... should work in ac2003. I don't know about ac2007. Your problem points to some sort of corruption since the code is good and the import worked.