Re: Compile Error
- From: "LMB" <RomulanQueen@xxxxxxxxxxxxxxx>
- Date: Tue, 4 Apr 2006 13:21:23 -0400
Thanks, Tina
OK, I will compile my code from now on. I used the word subroutine because
I remember on an episode in Star Trek, Commander Data had created a
subroutine and explained it as a "Program within a program", when I saw the
word Sub, I just kinda figured it was that. Procedure is what I think I
have read before somewhere.
I can handle the compile part when it doesn't have a problem. Thanks for
the moral support about VBA, I in fact have an appointment to see an
academic advisor this Friday to look into what I need to do to get an
individualized degree in healthcare and software design or something like
that. After getting my transcripts from 20 years ago, they may just say,
forget it! <g>
"tina" <nospam@xxxxxxxxxxx> wrote in message
news:0_lYf.680943$qk4.81177@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
well, you really should compile your code, whether it's all written by
wizards, or hand-written, or a mixture of both. if there's an error in the
code, it's not going to go away just because you don't know it's there
(don't we wish...! ;) )
in the case of this particular error, the system is telling you that the
"label" - Err_btnDepartmentSeniority_Click - doesn't exist in the
procedure
(or subroutine; AFAIK either term is okay). and when you read through the
whole procedure, you see that indeed it is not there. instead, the "label"
for the error-handling code is Err_btnDepartmentVTO_Click.
so change your code to
Private Sub btnDepartmentSeniority_Click()
On Error GoTo Err_btnDepartmentSeniority_Click
Dim stDocName As String
stDocName = "rptDepartmentSeniority"
DoCmd.OpenReport stDocName, acPreview
Exit_btnDepartmentSeniority_Click:
Exit Sub
Err_btnDepartmentSeniority_Click:
MsgBox Err.Description
Resume Exit_btnDepartmentSeniority_Click
End Sub
compare each line of the above code with your original code, so you can
see
exactly what changes i made, and where. there's a consistent pattern there
that should be easy to pick up on.
btw, don't feel bad about being intimidated by VBA - you're not alone.
when
i took a VBA class after using Access macros exclusively for two years, i
thought i was going to have a heart attack from the stress - i had a
TERRIBLE time trying to understand the basics. but i just forced myself to
quit using macros (cold turkey) and do everything in VBA, and gradually it
began to make sense and got easier. trust me - once you get the hang of
VBA,
you'll love all the things you can accomplish with it, stuff you could
never
dream of doing with macros! so hang in there! :)
hth
"LMB" <RomulanQueen@xxxxxxxxxxxxxxx> wrote in message
news:epH7Ye3VGHA.5148@xxxxxxxxxxxxxxxxxxxxxxx
Hi,book
Using Access 2000 and I guess it's time to really try to understand VB.
I
do have the book Beginning VB for Access 2000 but the thickness of the
intimidates me and forces me to just leave it on the shelf. Well, II
think
have learned all I can by trial and error and clicking around to see whatwhat
happens and I don't know the vb terms well enough to search for excatly
my problem is. I will be picking it up pretty soon but before I do, Iwas
wondering what the error message below is telling me? This code wascreated
by the program when I used the wizard to make a command button on a formto
open a report. The button works but after someone told me that I shouldthis
debug compile and save anytime I insert code (maybe they meant when I
made
it myself instead of using a wizard?) I decided to look at the
properties
of all my buttons and do this. When I clicked on debug/compile, I got
message.........Thanks Linda
Compile error: Label not defined.
The curser jumps to the following line...
On Error GoTo Err_btnDepartmentSeniority_Click
This is the whole subroutine...Is this a subroutine or a module or what?
___________________________________________________________
Private Sub btnDepartmentSeniority_Click()
On Error GoTo Err_btnDepartmentSeniority_Click
Dim stDocName As String
stDocName = "rptDepartmentSeniority"
DoCmd.OpenReport stDocName, acPreview
Exit_btnDepartmentVTO_Click:
Exit Sub
Err_btnDepartmentVTO_Click:
MsgBox Err.Description
Resume Exit_btnDepartmentVTO_Click
End Sub
_____________________________________________________________
.
- References:
- Compile Error
- From: LMB
- Re: Compile Error
- From: tina
- Compile Error
- Prev by Date: Re: Compile Error
- Next by Date: Copy data from one database to another from several tables
- Previous by thread: Re: Compile Error
- Next by thread: Re: Updating control
- Index(es):