PC Review


Reply
Thread Tools Rate Thread

Beginner's Visual Basic Question

 
 
=?Utf-8?B?VGhlIHBhcmF3b24=?=
Guest
Posts: n/a
 
      8th Feb 2005
I just started learning Visual Basic for Access 2003. I can use the
userforms and they give me back results when I try a message box. I'm
reading an older instruction lesson book from a few years ago that gives
instruction for "Visual Basic 6.0". When I do the following Sub in the
UserForm "View Code", things work brilliantly:

Public Sub UserForm_Click()
MsgBox "Hello World"
End Sub

However, when I try to the "Debug.Print", the lesson says I should get a
visible "2" on the form after clicking on it. But nothing is happening.
Can anyone put me in the right direction?


Private Sub UserForm_Click()
Debug.Print 4 / 2
End Sub

 
Reply With Quote
 
 
 
 
Mark via AccessMonster.com
Guest
Posts: n/a
 
      8th Feb 2005
Debug.Print prints to the Immediate Window. When you're in the VB Editor
looking at your code, press Ctl-G or choose "Immediate Window" from the
View Menu and you should see what the Debug.Print printed.

--
Message posted via http://www.accessmonster.com
 
Reply With Quote
 
Naresh Nichani MVP
Guest
Posts: n/a
 
      8th Feb 2005
Hi:

The Debug statement prints to an Immediate window in the Visual Basic Editor
(VBE). After the code stops at breakpoint, press F8 to execute the line.
Then press CTRL+G to view the Immediate window and you should see the result
of Debug.Print in this window.

Regards,

Naresh Nichani
Microsoft Access MVP

"The parawon" <(E-Mail Removed)> wrote in message
news:E6305672-B919-4B5E-AC4E-(E-Mail Removed)...
> I just started learning Visual Basic for Access 2003. I can use the
> userforms and they give me back results when I try a message box. I'm
> reading an older instruction lesson book from a few years ago that gives
> instruction for "Visual Basic 6.0". When I do the following Sub in the
> UserForm "View Code", things work brilliantly:
>
> Public Sub UserForm_Click()
> MsgBox "Hello World"
> End Sub
>
> However, when I try to the "Debug.Print", the lesson says I should get a
> visible "2" on the form after clicking on it. But nothing is happening.
> Can anyone put me in the right direction?
>
>
> Private Sub UserForm_Click()
> Debug.Print 4 / 2
> End Sub
>



 
Reply With Quote
 
John Nurick
Guest
Posts: n/a
 
      8th Feb 2005
Visual Basic 6.0 userforms and Access forms are different beasts
although they have many features in common and usually look the same.
The differences between VB6 controls such as textboxes and comboboxes
and their Access equivalents are even greater.

As a result, even though Visual Basic 6 and the Visual Basic for
Applications 6 used in Office 2003 are basically the same language, with
the same syntax and core, you'll continually hit snags if you use a VB6
reference when working with Access objects.


On Mon, 7 Feb 2005 20:17:02 -0800, "The parawon"
<(E-Mail Removed)> wrote:

>I just started learning Visual Basic for Access 2003. I can use the
>userforms and they give me back results when I try a message box. I'm
>reading an older instruction lesson book from a few years ago that gives
>instruction for "Visual Basic 6.0". When I do the following Sub in the
>UserForm "View Code", things work brilliantly:
>
>Public Sub UserForm_Click()
>MsgBox "Hello World"
>End Sub
>
>However, when I try to the "Debug.Print", the lesson says I should get a
>visible "2" on the form after clicking on it. But nothing is happening.
>Can anyone put me in the right direction?
>
>
>Private Sub UserForm_Click()
>Debug.Print 4 / 2
>End Sub


--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting started, Visual Basic beginner brock Microsoft VB .NET 8 22nd Mar 2008 01:41 AM
Visual Basic beginner question MikeB Microsoft VB .NET 4 12th Sep 2006 07:26 PM
Beginner Question: Visual Studio 2005 - Visual Basic - Charts or Graphs William Foster Microsoft Dot NET Framework Forms 2 25th Jan 2006 10:10 AM
Basic question for a beginner reo4966 Microsoft Excel Misc 8 10th Mar 2004 05:02 PM
Recommended Excel 2002/Visual Basic Book For Beginner? willik Microsoft Excel Programming 2 27th Feb 2004 04:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:08 AM.