473,396 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Frightening problem using Access 2003 code in 2007

Hi
Can anybody tell me why the VBA code below works fine in Access 2003
but doesn't work in Access 2007? I do not get any error message, even
if I put a deliberate error into the code. Also, if I put a debug
break point in the code, nothing happens. If I add the line msgbox
"ok" it displays the message box, so I know that it is reading the
code. This is a frightening problem, because if this doesn't display
errors, then what other bits of code are not working? This is
happening on every PC which has Access 2007.

Here's what should happen - when the user clicks on a list box, it
takes the value from the item he has clicked on and goes off and finds
the record which corresponds with the value.

Private Sub lstCompany_Click()
On Error GoTo err_handler

DoCmd.GoToRecord acActiveDataObject, , acFirst
txtNAME.Locked = False
txtNAME.SetFocus
DoCmd.FindRecord lstCompany.Column(0), acAnywhere, False, , False,
acCurrent, False
txtFindCompany.SetFocus
txtNAME.Locked = True
txtFindCompany.SetFocus
Exit Sub

err_handler:
MsgBox Err.Number & " " & Err.Description

Exit Sub

End Sub

Thanks a lot for any help

Colin
Mar 6 '08 #1
3 2244
ARC
I'm not sure why that would cause an error, however, you can check your vba
settings to help find the error message.

Open your code module, then in vba, click on tools, options. Verify that
error handling is set to "break on all errors". Recompile, and then when you
run you should at least get an error number / description.

Hope this helps,

Andy
"Bobby" <bo****@blueyonder.co.ukwrote in message
news:fb**********************************@60g2000h sy.googlegroups.com...
Hi
Can anybody tell me why the VBA code below works fine in Access 2003
but doesn't work in Access 2007? I do not get any error message, even
if I put a deliberate error into the code. Also, if I put a debug
break point in the code, nothing happens. If I add the line msgbox
"ok" it displays the message box, so I know that it is reading the
code. This is a frightening problem, because if this doesn't display
errors, then what other bits of code are not working? This is
happening on every PC which has Access 2007.

Here's what should happen - when the user clicks on a list box, it
takes the value from the item he has clicked on and goes off and finds
the record which corresponds with the value.

Private Sub lstCompany_Click()
On Error GoTo err_handler

DoCmd.GoToRecord acActiveDataObject, , acFirst
txtNAME.Locked = False
txtNAME.SetFocus
DoCmd.FindRecord lstCompany.Column(0), acAnywhere, False, , False,
acCurrent, False
txtFindCompany.SetFocus
txtNAME.Locked = True
txtFindCompany.SetFocus
Exit Sub

err_handler:
MsgBox Err.Number & " " & Err.Description

Exit Sub

End Sub

Thanks a lot for any help

Colin
Mar 6 '08 #2
On 6 Mar, 15:00, "ARC" <PCES...@PCESoft.invalidwrote:
I'm not sure why that would cause an error, however, you can check your vba
settings to help find the error message.

Open your code module, then in vba, click on tools, options. Verify that
error handling is set to "break on all errors". Recompile, and then when you
run you should at least get an error number / description.

Hope this helps,
I've just followed your advice. Unfortunately even with "break on all
errors" set, I still don't get an error from the code.

Colin
Mar 6 '08 #3
Interestingly on my PC I get and error message, which is "2142 The
FindRecord action requires a Find What argument". All other PCs I have
tried do not display a message. The only difference is, I have both
2007 and 2003 on my PC.

So, I have two issues - The error above and more alarmingly (I think!)
the fact that nobody apart from me is getting error messages. Have we
just forgotten to tick a box when we setup Access 2007?

Colin
Mar 6 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

37
by: jasmith | last post by:
How will Access fair in a year? Two years? .... The new version of Access seems to service non programmers as a wizard interface to quickly create databases via a fancy wizard. Furthermore, why...
27
by: Wayne | last post by:
I've been clicking around Access 2007 Beta 2 and can't see the custom menu bar designer. Is it in the beta? Maybe I'm blind. The question that comes to mind is: Will custom menu bars be the same...
10
by: Jeff | last post by:
This is something I can't test (don't have 2007) and found no definitive answer, but a few conflicting ones. Will a 2003 database work correctly in Access 2007? Don't want to do any design...
8
by: elias.farah | last post by:
Hello Everyone, I'm having some very weird behavior on a couple of Access forms. (Not all forms, just some of them). The forms have been working for years, under Access XP/2003 etc, and last...
6
by: tony.abbitt | last post by:
I have recently installed Office 2007 (SP1) retaining the previous installation of Office 2003. I have converted an Access 2003 database to Access 2007. The database contains the VBA code...
9
by: prakashwadhwani | last post by:
Hi !! I'm about to develop a new project for a client. Should I go about it in Access 2003 or 2007 ? Purchasing it either for me or for my client is not a major consideration here ... what I'd...
20
by: KW | last post by:
I have an application that runs in any of Access 2000 thru Access 2007 to accommodate my customers' various environments. I implemented code to call a function that uses the LoadCustomUI method to...
5
by: Lysander | last post by:
My collegue had to buy a new laptop that came with Office 2007 already installed. She had Access 2003 installed on top, in a different directory. None of our 2003 databases will run on her...
1
by: BL3WC | last post by:
Hi, I'd created a MDE under Access 2003. It is now under testing stage. Some of the users will use Access 2003 runtime and some will use Access 2007 runtime to run this MDE. I installed the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.