Prev Previous Post   Next Post Next
  #3   Report Post  
Paul
 
Posts: n/a
Default setfocus

Works a treat.

Thanks for your time

Paul

"Jay Freedman" wrote:

Hi Paul,

Instead of SetFocus, the method name for a combo box from the Control
Toolbox is either Select or Activate (I'm not sure what the difference is,
if there is any).

If you just try to use cmbq1a.Select at that point in the macro, though, it
won't work. There's a timing bug, explained at
http://word.mvps.org/FAQs/TblsFldsFm...ateFFields.htm. This variation,
based on the code in the article, will work:

Private Sub cmbq1a_LostFocus()
If IsNull(cmbq1a) Or cmbq1a = "" Then
MsgBox "Please select a valid entry from question 1A", _
vbCritical, "Error"
Application.OnTime When:=Now + TimeValue("00:00:01"), _
Name:="GoThere"
End If
End Sub

Sub GoThere()
cmbq1a.Select
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org

Paul wrote:
I develop in access but was asked to put togther a questionaire in
word.

I have added combo boxes to a document.

to add some validation checking I added;

If IsNull(cmdq1a) Or cmbq1a = "" Then
MsgBox "Please select a valid entry from question from 1A",
vbCritical, apptitle
Exit Sub
End If

in access i am able to include
cmbq1a.setfocus
after the msgbox entry to place the cursor/focus back to the relevant
combox box.

Word gives me a runtime error 438 object does not support this
property ot method.

How can I acheive this ? - cheers




 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:22 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"