Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

Multipage Control

Yet another difficult one - researched all manner of books and net without success!
I have a Multipage object of three pages.  I want to control which Multipage is visible/selected/top-most when I execute the setfocus on a text box in that page - otherwise it generates an error.

Two of us have tried to solve this - one very experienced VB/Access programmer and me, the novice.
There is no guarantee that the necessary Multipage.page will be open on entering the form - I can test for that.  The problem is leaving the form, if the data causes an error (which I check for) I need to force the user to the approrpiate multi.page(i) and setfocus to the textbox!!

Easy - should be written somewhere one would think?
0
drummerboy
Asked:
drummerboy
  • 3
1 Solution
 
JohnMcCannCommented:
Have you tried

Private Declare Function Putfocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long

During the datavalidation if the Validation fails use PutFocus Text1.hWnd
0
 
JohnMcCannCommented:
You may need to PutFocus on the form first if it has lost it.  
0
 
JohnMcCannCommented:
So in order

PutFocus Form1.hWnd  'Set focus to from
MultiPage1.Value = 0 'Set visible page to index 0
PutFocus Text1.hWnd
0
 
GPrentice00Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

 -->Accept JohnMcCann's comment as Answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now