Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: This would be easy if I wasn't brain dead

Geek News

This would be easy if I wasn't brain dead
dhstein 11/26/2008 7:14:08 PM
OK - I coded a subroutine from the book that looks like this:
Option Compare Database
Option Explicit
Sub BeepWarning()
Dim xBeeps As Integer
Dim nBeeps As Integer
nBeeps = 5
For xBeeps = 1 To nBeeps
Beep
Next xBeeps
End Sub



Then I selected the event to run and got this:

Private Sub btnBeep_Click()
BeepWarning()
End Sub

When I click the button I get:
Compile Error Syntax Error message

Any help would be appreciated

Re: This would be easy if I wasn't brain dead
"Damon Heron" <damon_327[ at ]hotmail.com> 11/26/2008 7:38:54 PM
Drop the parens in the call
BeepWarning

Damon

"dhstein" <dhstein[ at ]discussions.microsoft.com> wrote in message
news:02EF54C1-6BF1-4B05-9BA4-100432F6423C[ at ]microsoft.com...
[Quoted Text]
> OK - I coded a subroutine from the book that looks like this:
> Option Compare Database
> Option Explicit
> Sub BeepWarning()
> Dim xBeeps As Integer
> Dim nBeeps As Integer
> nBeeps = 5
> For xBeeps = 1 To nBeeps
> Beep
> Next xBeeps
> End Sub
>
>
>
> Then I selected the event to run and got this:
>
> Private Sub btnBeep_Click()
> BeepWarning()
> End Sub
>
> When I click the button I get:
> Compile Error Syntax Error message
>
> Any help would be appreciated
>


Re: This would be easy if I wasn't brain dead
dhstein 11/26/2008 7:48:01 PM


"Damon Heron" wrote:

[Quoted Text]
> Drop the parens in the call
> BeepWarning
>
> Damon
>
> "dhstein" <dhstein[ at ]discussions.microsoft.com> wrote in message
> news:02EF54C1-6BF1-4B05-9BA4-100432F6423C[ at ]microsoft.com...
> > OK - I coded a subroutine from the book that looks like this:
> > Option Compare Database
> > Option Explicit
> > Sub BeepWarning()
> > Dim xBeeps As Integer
> > Dim nBeeps As Integer
> > nBeeps = 5
> > For xBeeps = 1 To nBeeps
> > Beep
> > Next xBeeps
> > End Sub
> >
> >
> >
> > Then I selected the event to run and got this:
> >
> > Private Sub btnBeep_Click()
> > BeepWarning()
> > End Sub
> >
> > When I click the button I get:
> > Compile Error Syntax Error message
> >
> > Any help would be appreciated
> >
>
>
> Now I get: Compile error : Expected variable or procedure, not module
Re: This would be easy if I wasn't brain dead
Steve Sanford 11/26/2008 8:46:33 PM
It sounds like you have a standard module named "BeepWarning" and a
subroutine named "BeepWarning".

You cannot have two objects with the same name. Change one of them to a
different name. My test of your code worked fine.

HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


"dhstein" wrote:

[Quoted Text]
>
>
> "Damon Heron" wrote:
>
> > Drop the parens in the call
> > BeepWarning
> >
> > Damon
> >
> > "dhstein" <dhstein[ at ]discussions.microsoft.com> wrote in message
> > news:02EF54C1-6BF1-4B05-9BA4-100432F6423C[ at ]microsoft.com...
> > > OK - I coded a subroutine from the book that looks like this:
> > > Option Compare Database
> > > Option Explicit
> > > Sub BeepWarning()
> > > Dim xBeeps As Integer
> > > Dim nBeeps As Integer
> > > nBeeps = 5
> > > For xBeeps = 1 To nBeeps
> > > Beep
> > > Next xBeeps
> > > End Sub
> > >
> > >
> > >
> > > Then I selected the event to run and got this:
> > >
> > > Private Sub btnBeep_Click()
> > > BeepWarning()
> > > End Sub
> > >
> > > When I click the button I get:
> > > Compile Error Syntax Error message
> > >
> > > Any help would be appreciated
> > >
> >
> >
> > Now I get: Compile error : Expected variable or procedure, not module
Re: This would be easy if I wasn't brain dead
dhstein 11/26/2008 8:59:00 PM


"Steve Sanford" wrote:

[Quoted Text]
> It sounds like you have a standard module named "BeepWarning" and a
> subroutine named "BeepWarning".
>
> You cannot have two objects with the same name. Change one of them to a
> different name. My test of your code worked fine.
>
> HTH
> --
> Steve S
> --------------------------------
> "Veni, Vidi, Velcro"
> (I came; I saw; I stuck around.)
>
>
> "dhstein" wrote:
>
> >
> >
> > "Damon Heron" wrote:
> >
> > > Drop the parens in the call
> > > BeepWarning
> > >
> > > Damon
> > >
> > > "dhstein" <dhstein[ at ]discussions.microsoft.com> wrote in message
> > > news:02EF54C1-6BF1-4B05-9BA4-100432F6423C[ at ]microsoft.com...
> > > > OK - I coded a subroutine from the book that looks like this:
> > > > Option Compare Database
> > > > Option Explicit
> > > > Sub BeepWarning()
> > > > Dim xBeeps As Integer
> > > > Dim nBeeps As Integer
> > > > nBeeps = 5
> > > > For xBeeps = 1 To nBeeps
> > > > Beep
> > > > Next xBeeps
> > > > End Sub
> > > >
> > > >
> > > >
> > > > Then I selected the event to run and got this:
> > > >
> > > > Private Sub btnBeep_Click()
> > > > BeepWarning()
> > > > End Sub
> > > >
> > > > When I click the button I get:
> > > > Compile Error Syntax Error message
> > > >
> > > > Any help would be appreciated
> > > >
> > >
> > >
> > > Now I get: Compile error : Expected variable or procedure, not module


Thanks Steve - that was it.
Re: This would be easy if I wasn't brain dead
Steve Sanford 11/27/2008 4:12:09 PM
You're welcome :D
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


"dhstein" wrote:

[Quoted Text]
>
>
> "Steve Sanford" wrote:
>
> > It sounds like you have a standard module named "BeepWarning" and a
> > subroutine named "BeepWarning".
> >
> > You cannot have two objects with the same name. Change one of them to a
> > different name. My test of your code worked fine.
> >
> > HTH
> > --
> > Steve S
> > --------------------------------
> > "Veni, Vidi, Velcro"
> > (I came; I saw; I stuck around.)
> >
> >
> > "dhstein" wrote:
> >
> > >
> > >
> > > "Damon Heron" wrote:
> > >
> > > > Drop the parens in the call
> > > > BeepWarning
> > > >
> > > > Damon
> > > >
> > > > "dhstein" <dhstein[ at ]discussions.microsoft.com> wrote in message
> > > > news:02EF54C1-6BF1-4B05-9BA4-100432F6423C[ at ]microsoft.com...
> > > > > OK - I coded a subroutine from the book that looks like this:
> > > > > Option Compare Database
> > > > > Option Explicit
> > > > > Sub BeepWarning()
> > > > > Dim xBeeps As Integer
> > > > > Dim nBeeps As Integer
> > > > > nBeeps = 5
> > > > > For xBeeps = 1 To nBeeps
> > > > > Beep
> > > > > Next xBeeps
> > > > > End Sub
> > > > >
> > > > >
> > > > >
> > > > > Then I selected the event to run and got this:
> > > > >
> > > > > Private Sub btnBeep_Click()
> > > > > BeepWarning()
> > > > > End Sub
> > > > >
> > > > > When I click the button I get:
> > > > > Compile Error Syntax Error message
> > > > >
> > > > > Any help would be appreciated
> > > > >
> > > >
> > > >
> > > > Now I get: Compile error : Expected variable or procedure, not module
>
>
> Thanks Steve - that was it.

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net