Object Variable With Variable Not Defined Error 
Author Message
 Object Variable With Variable Not Defined Error

Greetings,
After I run a userform and click the OK button I get an error message
that the Object Variable or With Variable is not defined.
However, the userform enters the appropriate info into the document
which makes me think it may be the  "Me.Hide" that's causing the
problem? The VBA help isn't being much help.
Here's the code for the button on the form:

Private Sub CommandButton1_Click()

'set variables for each text box on form
    vName = frmClientInfo.tBox_Name.Text
    vDate = frmClientInfo.tBox_Date.Text
    vSSN = frmClientInfo.tBox_SSN.Text
    vBegin = frmClientInfo.tBox_BegTime.Text
    vEnd = frmClientInfo.tBox_EndTime.Text
    vTotal = frmClientInfo.tBox_TotTime.Text

'place textbox values into the document
   ActiveDocument.FormFields("bkName").Result = vName
   ActiveDocument.FormFields("bkDate").Result = vDate
   ActiveDocument.FormFields("bkSSN").Result = vSSN
   ActiveDocument.FormFields("bkBegTime").Result = vBegin
   ActiveDocument.FormFields("bkEndTime").Result = vEnd
   ActiveDocument.FormFields("bkTotTime").Result = vTotal

Me.Hide
End Sub

TIA,
Jim Adams
Maysville KY  USA



Tue, 16 Mar 2004 02:18:59 GMT  
 Object Variable With Variable Not Defined Error


More info to this post. I do not get this error when running the code
in the *.dot file, only when the template serves as the basis for a
new document.

Jim Adams
Maysville KY USA

Quote:
>Greetings,
>After I run a userform and click the OK button I get an error message
>that the Object Variable or With Variable is not defined.
>However, the userform enters the appropriate info into the document
>which makes me think it may be the  "Me.Hide" that's causing the
>problem? The VBA help isn't being much help.
>Here's the code for the button on the form:

>Private Sub CommandButton1_Click()

>'set variables for each text box on form
>    vName = frmClientInfo.tBox_Name.Text
>    vDate = frmClientInfo.tBox_Date.Text
>    vSSN = frmClientInfo.tBox_SSN.Text
>    vBegin = frmClientInfo.tBox_BegTime.Text
>    vEnd = frmClientInfo.tBox_EndTime.Text
>    vTotal = frmClientInfo.tBox_TotTime.Text

>'place textbox values into the document
>   ActiveDocument.FormFields("bkName").Result = vName
>   ActiveDocument.FormFields("bkDate").Result = vDate
>   ActiveDocument.FormFields("bkSSN").Result = vSSN
>   ActiveDocument.FormFields("bkBegTime").Result = vBegin
>   ActiveDocument.FormFields("bkEndTime").Result = vEnd
>   ActiveDocument.FormFields("bkTotTime").Result = vTotal

>Me.Hide
>End Sub

>TIA,
>Jim Adams
>Maysville KY  USA



Tue, 16 Mar 2004 02:28:07 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Runtime error 91: Object or with block variable not defined

2. Error msg: Object variable or With block variable not set

3. Object variable or With block variable not set (Error 91)

4. error 91 Object Variable o on with block variable is not set

5. Runtime error 91/Object variable or With block variable not set problems

6. Object variable or With block variable not set error in Class

7. runtime error: 91 Object variable or with block variable not set

8. Object variable or With block variable not set (Error 91) Please Help

9. Object variable variable not set error.

10. Object variable variable not set error.

11. Run Time Error 91: Object variable or With Block variable not set

12. VB 5.0 - Error:91 Object Variable Or With Block Variable Not Set

 

 
Powered by phpBB® Forum Software