Access 2007 VBA issue

I have converted an application from Access 2003 to Access 2007. I had to disable some code to make the form load. However there are still some functionalists that don't seem to work and as a result Access crashes - Any ideas?

Access crashes as soon as it reaches the following line..

 Me.cboTaskCreatedBy = Val(Me.lblUserID.Caption)
Me.txtTaskCreateDate = Now
 Me.cboTaskCreatedBy = Val(Me.lblUserID.Caption)

Open in new window

Crash-shot.png
mkarkoukliAsked:
Who is Participating?
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
What is the contents of

Me.lblUserID.Caption ?

Hey ... at least they are sorry for the inconvenience!

mx
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
Instead of 'converting', how about taking your original A2003 app .... >> create a brand new empty A2007 ACCDB, then import ALL objects into the ACCDB from the A2003 app.

And before you do this, run this procedure on the A2003 app - for good measure:

if you have not already:
Open the VBA Editor and from the menu ...Tools>>References ....
If you see any listed as **Missing: <reference name>, including the asterisks and the word Missing, the
you need to fix that first.

Then, follow this procedure:

****
0) **Backup your MDB BEFORE running this procedure**
****
1) Compact and Repair the MDB, as follows:
Hold down the Shift key and open the MDB, then from the menu >>Tools>>Database Utilities>>Compact and Repair ...
Close the mdb after the Compact & Repair.
2) Execute the Decompile (See example syntax below) >> after which, your database will reopen.
3) Close the mdb
4) Open the mdb and do a Compact and Repair (#1 above).
5) Close the mdb.
6) Open the mdb:
    a) Right click over a 'blank' area of the database window (container) and select Visual Basic Editor. A new window will open with the title 'Microsoft Visual Basic' ... followed by then name of your MDB.
    b) From the VBA Editor Menu at the top of the window:
       >>Debug>>Compile
        Note ... after the word Compile ...you will see the name of your 'Project' - just an fyi.

7) Close the mdb
8) Compact and Repair one more time.

*** Executing the DeCompile **EXAMPLE**:
Here is an **example** of the command line syntax  (be SURE to adjust your path and file name accordingly) before executing the decompile:

Run this from Start>>Run, enter the following command line - **all on one line** - it may appear like two lines here in the post:
Also, the double quotes are required.

"C:\Program Files\Microsoft Office\Office\Msaccess.exe" /decompile "C:\Access2003Clients\YourMdbNameHERE.mdb"

For more detail on the Decompile subject ... visit the Master on the subject (and other great stuff) Michael Kaplan:

http://www.trigeminal.com/usenet/usenet004.asp?1033

mx
0
 
mkarkoukliAuthor Commented:
The content is an integer to bind it to the combo box..

Microsoft let their users to be the testing filed for their products. lol
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
"The content is an integer to bind it to the combo box..'

Can you give an example?  Why are you using Val() ?

mx
0
 
mkarkoukliAuthor Commented:
I'm using the Val() in order to convert the value from a label control to a numeric. As far as I know the caption will hold a string, but the combo box requires a numeric value (which is the key field) to show the name.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
If the Caption is all numbers then (?) ... try this workaround:

CLng(Me.lblUserID.Caption)

BUT ... try the import and decompile procedure also.

mx
0
 
mkarkoukliAuthor Commented:

No, that didn't work either. I even tried without any conversion, the same error happened.
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Connect With a Mentor Infotrakker SoftwareCommented:
See if you have a stray .ldb file in the same folder as the database. Do this with the db closed; there should be NO .ldb files in that folder with the same name as your database. For example, if your db is named MyDatabase.mdb, Access will create a lockfile named MyDatabase.ldb ... sometimes this file isn't destroyed when Access ends abruptly, and can cause issues if not removed.

Still, as MX said, if you must work with a 2003 or earlier db in 2007, you should always create a new, blank db in 2007 (you can do so in the earlier formats - no need to convert to the .accdb format if you don't want) and import everything into it.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.