New Install - problems with existing modules etc

A

Anne

My database has a problem since I installed office 2003 on a new laptop, but
everything is fine on my old laptop. Both are running Windows XP, Office 2003
SP3, libraries are the same in both. I now have on both computers the same
back end and front end. I can't figure out why some items don't work on the
new computer and I am trying to narrow it down to specific.
Even for the close button comes up with an error message: The expression On
Click you entered as the event property setting produced the following error:
Label not defined.
Private Sub Cancel7_Click()
DoCmd.Close acForm, Me.name
End Sub
What am I looking for?
 
C

Chris O'C via AccessMonster.com

"Label not defined" means you have a goto command that doesn't have a
corresponding label within that procedure. Try to compile the vba code and
the compiler will highlight the line of code naming the label that's missing.

Chris
Microsoft MVP
 
A

Anne

The strange thing is, that this form works on my old laptop, therefore there
should not be a problem. It stops at any label on this particular form, like
a combobox. I am using Stephen Lesban's calendar module on this form and the
 
C

Chris O'C via AccessMonster.com

Please post the code for the load event and the unload event. Please
indicate which line is highlighted by the compiler if there's more than one
goto command in each procedure.

Chris
Microsoft MVP
 
A

Anne

Private Sub Form_Load()
' This must appear here!
' Create an instance of our Class
Set mc = New clsMonthCal
' ** YOU MUST SET THE hWndForm Property!
mc.hWndForm = Me.hWnd
End Sub


Private Sub Form_Unload(Cancel As Integer)
' This is required in case user Closes Form with the
' Calendar still open. It also handles when the
' user closes the application with the Calendar still open.

If Not mc Is Nothing Then
If mc.IsCalendar Then
Cancel = True
Exit Sub
End If


Set mc = Nothing
End If
End Sub

It actually never opens the form, anything I click on, it comes up as label
not defined. If I run compile it stops at another form at the following code
Sub cboMoveTo_AfterUpdate()
Dim rs As DAO.Recordset

If Not IsNull(Me.cbomoveto) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[JobID] = " & Me.cbomoveto
If rs.NoMatch Then
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

Highligted is me.cbomoveto actually only the cbomoveto and not me.
I use this cbomoveto and the calendar routine on many forms, this is the
only one with a problem.
 
C

Chris O'C via AccessMonster.com

When the compiler highlights cbomoveto I don't think the compiler error
message is "label not found" so it means you have multiple errors and you
have to fix each one until you fix them all and the code compiles completely.

What's the exact error message when the compiler highlights cbomoveto? Does
that form not have a combo box named cbomoveto any more?

Chris
Microsoft MVP

Private Sub Form_Load()
' This must appear here!
' Create an instance of our Class
Set mc = New clsMonthCal
' ** YOU MUST SET THE hWndForm Property!
mc.hWndForm = Me.hWnd
End Sub

Private Sub Form_Unload(Cancel As Integer)
' This is required in case user Closes Form with the
' Calendar still open. It also handles when the
' user closes the application with the Calendar still open.

If Not mc Is Nothing Then
If mc.IsCalendar Then
Cancel = True
Exit Sub
End If

Set mc = Nothing
End If
End Sub

It actually never opens the form, anything I click on, it comes up as label
not defined. If I run compile it stops at another form at the following code
Sub cboMoveTo_AfterUpdate()
Dim rs As DAO.Recordset

If Not IsNull(Me.cbomoveto) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[JobID] = " & Me.cbomoveto
If rs.NoMatch Then
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub

Highligted is me.cbomoveto actually only the cbomoveto and not me.
I use this cbomoveto and the calendar routine on many forms, this is the
only one with a problem.
Please post the code for the load event and the unload event. Please
indicate which line is highlighted by the compiler if there's more than one
[quoted text clipped - 8 lines]
 
L

Linq Adams via AccessMonster.com

The Access gnomes frequently get confused as the actual cause of an error,
especially, it seems, when there are multiple errors, and the error messages
are not always very helpful.

When apps run fine on one machine and not on another, the first thing you
have to think about are missing references.

Here are Doug Steele's instructions on how to troubleshoot the problem:

*** Quote ***

Any time functions that previously worked suddenly don't, the first thing to
suspect is a references problem.

This can be caused by differences in either the location or file version of
certain files between the machine where the application was developed, and
where it's being run (or the file missing completely from the target machine).
Such differences are common when new software is installed.

On the machine(s) where it's not working, open any code module (or open the
Debug Window, using Ctrl-G, provided you haven't selected the "keep debug
window on top" option). Select Tools | References from the menu bar. Examine
all of the selected references.

If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in and
reselect them.

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out of
the dialog, then go back in and reselect the references you just unselected.
(NOTE: write down what the references are before you delete them, because
they'll be in a different order when you go back in)

For far more than you could ever want to know about this problem, check out

http://www.accessmvp.com/djsteele/AccessReferenceErrors.html

Just so you know: the problem will occur even if the library that contains
the specific function that's failing doesn't have a problem.

**** End Quote ****
 
A

Anne

I have tried all suggestions without success. This form is almost identical
to another form which works. I copied an pasted the main items from the
working form to the non working form. I deleted all other items on the non
working form and still the errors. I think I will create a new form from
scratch.
It just does not leave me with much confidence, that I won't run into the
same problems sometime later.
 
A

Anne

I am using Allen Browne's suggestion of re-registering the libraries and I am
getting an error:
C:\program files\common files\system\ado\msado21.tlb was loaded, but the
DllRegisterServer entry point was not found. C:\program files\common
files\system\ado\msado21.tlb does not appear to be a .dll or .ocx
What does that mean?
 
A

Anne

Apparently it is not important.
On my old laptop, I thought I would try and recompile, and it also stopped
at the first Me.combobox with member or datafile not found. I searched this
newsgroup for the error and found several suggestions of replacing the period
with an exclamation mark. I did a search for Me. and replaced it with Me!
The compile ran flawless. I transferred the file to new computer and now the
program works there as well.
 
C

Chris O'C via AccessMonster.com

It means you're trying to sell your horse to a horse trader and he's saying
"Lady, I'm not buying it from you".

You ask "Why not? This horse might win the Kentucky Derby!"

And he says "Because it's a cow".

Chris
Microsoft MVP
 
C

Chris O'C via AccessMonster.com

It seems to me you can know when it's *not* a missing reference because the
compiler has already tokenized the source code and didn't come up with
anything undefined or misidentified. If it's a missing reference you see the
tell-tale error messages like "method or data member not found", "user
defined type not found" and "error 13 - data type mismatch". You'll always
get those compiler messages first before any other compiler messages if any
references are missing.

If the compiler gets as far as "label not defined" before deciding the code
is horked, the libraries are fine.

Chris
Microsoft MVP
 
C

Chris O'C via AccessMonster.com

The compiler doesn't check whether Me!combobox exists at compile time, it
checks it at runtime, so it compiles successfully even if Me!combobox doesn't
exist.

If you check it at compile time, Me.combobox *must* exist on the form. If it
doesn't you get the "method or data member not found" error message.

But the code you posted named the combo box control cbomoveto, not combobox.
I asked you if cbomoveto was no longer on your form. Is this a different
error message you were working on?

Chris
Microsoft MVP
 
C

Chris O'C via AccessMonster.com

I should've also said the form doesn't have a bound field by that name so you
got the compile error. cbomoveto is probably the name of the control, which
can be referred to in code when using the bang operator but not the dot
operator when the field name is different.

Chris
Microsoft MVP

The compiler doesn't check whether Me!combobox exists at compile time, it
checks it at runtime, so it compiles successfully even if Me!combobox doesn't
exist.

If you check it at compile time, Me.combobox *must* exist on the form. If it
doesn't you get the "method or data member not found" error message.

But the code you posted named the combo box control cbomoveto, not combobox.
I asked you if cbomoveto was no longer on your form. Is this a different
error message you were working on?

Chris
Microsoft MVP
Apparently it is not important.
On my old laptop, I thought I would try and recompile, and it also stopped
[quoted text clipped - 3 lines]
The compile ran flawless. I transferred the file to new computer and now the
program works there as well.
 
A

Anne

I have this terrible feeling, that this is going to come back to haunt me
sometime in the future. Things seem fine right now, but I am going to work on
rebuilding this database using Allen Browne's guidelines for corrupted
databases.
Thanks,
 
C

Chris O'C via AccessMonster.com

I doubt it's corrupted. Someone made changes after the form was created and
the changes don't match what they should.

Chris
Microsoft MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top