![]() |
#1
|
||||
|
||||
![]()
Okay I have looked read and tried different examples of trying to setfocus to any field on the userform if it is empty. The following is what I have come up with so far and I get an error trying to get to my page2 of the multipage userform. At the last minute I threw in the Me.frmProofInfo.value = 0 but that doesn't work either.
As usual any help or direction is appreciated. *edit I added the line Me.frmProofInfo.Show as well. If I take those lines out the focus to page1 works fine. It is still trying to get focus on page2. Code:
Private Sub cmdOk_Click() 'Ok button was clicked now do the following ActiveWindow.ActiveView.ToFitPage 'check if any textbox is empty of information needed 'added this section 2012.10.24 Me.frmProofInfo.Value = 0 If txtJobSummary.Value = "" Then MsgBox "We could use a job description here!" Me.frmProofInfo.Show Me.txtJobSummary.SetFocus Exit Sub ElseIf cmbFilename.Value = "" Then MsgBox "If we don't know the filename how are we supposed to revise anything if needed!" Me.frmProofInfo.Show Me.cmbFilename.SetFocus Exit Sub ElseIf txtFilename.Value = "" Then MsgBox "If we don't know the filename how are we supposed to revise anything if needed!" Me.frmProofInfo.Show Me.txtFilename.SetFocus Exit Sub End If Me.frmProofInfo.Value = 1 If txtContact.Value = "" Then MsgBox "We really need to know who this is going to!" txtContact.SetFocus Exit Sub ElseIf txtBusiness.Value = "" Then MsgBox "Umm is there no business?!?" txtBusiness.SetFocus Exit Sub ElseIf txtEmail.Value = "" Then MsgBox "Most people usually have an email these days!" txtEmail.SetFocus Exit Sub End If Last edited by byteme67; 24-10-2012 at 13:49. |
#2
|
||||
|
||||
![]()
Hi.
Is it possible you either attach the gms so we can test, or at least a mock up gms with form demonstrating problem. This would be easier to test. ~John |
#3
|
||||
|
||||
![]()
sure here it is.
|
#4
|
||||
|
||||
![]()
Hi.
I was having some luck with this: Code:
Private Sub setFocus() Dim c As Control For Each c In Me.Controls If c.Width = 78 Or c.Width = 354 Or c.Width = 360 Or c.Width = 160 Or c.Width = 192 Then If c.Value = "" Then c.setFocus: Exit Sub End If End If Next c End Sub I also had to change alot of things in your code to make macro start, like: Code:
Private Sub mpageProof_Change() On Error Resume Next '<<<<<<<<<<<<<<<<<<added this Select Case mpageProof.Value Case 0 'Call viewpageinfo ActiveDocument.Views("Proof Info").Activate Case 1 'Call viewpagecontact ActiveDocument.Views("Proof Area").Activate Case Else 'Do Nothing End Select End Sub Code:
'check if Additional Page layer is active If Not ActivePage.Layers.Find("Additional Page") Is Nothing Then '<<<aded this If Statement ActivePage.Layers("Additional Page").Activate chkAddlPgs.Value = ActivePage.Layers("Additional Page").Visible End If 'check if Enlarged layer is active If Not ActivePage.Layers.Find("Enlarged") Is Nothing Then '<<<aded this If Statement ActivePage.Layers("Enlarged").Activate chkEnlarged.Value = ActivePage.Layers("Enlarged").Visible End If |
#5
|
||||
|
||||
![]()
Thanks John! I am assuming the few suggested lines were more for error trapping. I am not to good at that.
![]() But I am curious on the is the c.width the position of the control on the page? |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Another Focus question | xombie | CorelDRAW/Corel DESIGNER VBA | 6 | 20-09-2010 16:38 |
set focus on a commandBarControl | biok | CorelDRAW/Corel DESIGNER VBA | 1 | 26-08-2009 13:27 |
Return Focus to Text Box | cooloox | CorelDRAW/Corel DESIGNER VBA | 4 | 31-03-2009 03:25 |
Textbox in Form and Passing Control Focus. | knowbodynow | CorelDRAW/Corel DESIGNER VBA | 4 | 23-05-2008 23:39 |
Closing a form when something else gets focus | Gadget | CorelDRAW/Corel DESIGNER VBA | 3 | 23-01-2008 06:51 |