Form Visible True/False Set Focus issue results in 2018 error (1 Viewer)

miken5678

Registered User.
Local time
Today, 02:22
Joined
Jul 28, 2008
Messages
113
I have three tabs which the visible setting is driven off of three other fields one field drives each tab.

I was running into an issue while going through each record where it could not hide a field that had current focus. I noticed this happens when i try to click through records rather quickly. If i click slowly for next record there is no error. I am puzzled. **Nevermind, this seems intermittent and is hard to duplicate the cant hide control on focus. I am out of ideas.

I found a few examples online to set focus to an item on the screen. To which i set focus on one main field outside the tab.

The result is everything is fine however when i click no, which should hide the tab, i get an error you must save the field before you execute the gotocontrol action. run time error 2108

Code:
Public Function MortgageeFunction()
If Forms!WindOptout!FrameMortgagee = 1 Then
    Forms!WindOptout!TabMortgagee.Visible = True
ElseIf Forms!WindOptout!FrameMortgagee = 2 Then
    Forms!WindOptout!FrameMortgageeDocument = Null
    Forms!WindOptout!FrameMortgageeDocumentOtherIssues = Null
    Forms!WindOptout!TextFrameMortgageeDocumentOtherIssuesComment = Null
    Forms!WindOptout!TabMortgagee.Visible = False
    Forms!WindOptout!PolicyNumber.SetFocus
Else
    Forms!WindOptout!PolicyNumber.SetFocus
    Forms!WindOptout!TabMortgagee.Visible = False
End If
End Function
 

Attachments

  • Wind & Contents Opt Out.zip
    332.4 KB · Views: 111

missinglinq

AWF VIP
Local time
Today, 05:22
Joined
Jun 20, 2003
Messages
6,423
First a couple of things.

You need to be careful of your thread title when posting. I've been scratching my head trying to figure out what Data Access Pages had to do with your problem. Then I figured out that the 2018 error listed in your title was supposed to be 2108!

Also, when attaching a file for us to download, please mention the fact that you're running Access 2007 or 2010. There are bunches of us here, like myself, who are still running 2003 or earlier. For us, downloading a 2007/2010 file is a waste of time, as we cannot run/look at them.

Now to your problem. I have no idea what you mean by this:

"The result is everything is fine however when i click no, which should hide the tab, i get an error you must save the field before you execute the gotocontrol action."

What is this no you speak of clicking on?

Where are you calling the MortgageeFunction() from, in your code?

I think a little more explanation of exactly how you're trying to do this is necessary for us to help you here.

Linq ;0)>
 

miken5678

Registered User.
Local time
Today, 02:22
Joined
Jul 28, 2008
Messages
113
When I have two tabs everything works fine when hiding and unhiding. However when I add a third tab which visible property varies it was causing and issue losing focus so to get around that i stuck the third tab data inside each of the original two tabs.

Since I am new to this any advice is appreciated on visible and assigning values when it comes to before and after events.

I assume ultimately to insure data integrity that any after event should not contain criteria to change the value of a field? That when you go back to a prior record there is no chance to change data?

When I start to setup fields that are visible true/false I always include the following

on form event
after even of the field
before even of the field

That way when I scroll through prior records the fields follow the same rules and go back to visible. Is this the correct way or is there another preferred method and adding a second function only on the before event to insure that data values arent changed when scrolling back?

I have attached an 03 version for you and apologize for any confusion
 

Attachments

  • Wind & Contents Opt Out2003.zip
    183.2 KB · Views: 133

Users who are viewing this thread

Top Bottom