473,405 Members | 2,310 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,405 software developers and data experts.

Code Fails on second strSQL definition

I am updating records in 2 tables, Employees and Projects with a new value for NAMEPHONE
The code fails on the second update in one sub
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdNewName_Click()
  2.     Dim conDatabase As DAO.Database
  3.     Dim strSQL As String
  4.  
  5. '  code which works beautifully
  6.     Set conDatabase = CurrentDb
  7.     strSQL = "UPDATE Projects SET Namephone= '" & Newname & "' WHERE NamePhone='" & oldname & "'"
  8.     conDatabase.Execute (strSQL)
  9.  
  10.  
  11.    ' and then I fail on line conDatabase.Execute (strSQL) !!!
  12.      strSQL = "UPDATE Employees SET Nampephone='" & Newname & "' Where NamePhone='" & oldname & "'"
  13.      conDatabase.Execute (strSQL)
  14.     
  15.  
  16.  
  17.     conDatabase.Close
  18.     Set conDatabase = Nothing
  19. End Sub
Apr 8 '13 #1
3 1139
Rabbit
12,516 Expert Mod 8TB
It fails how? Is there an error message? What is it?
Apr 8 '13 #2
TheSmileyCoder
2,322 Expert Mod 2GB
Line 12, I believe you have a typo.
Nampephone should have been Namephone
Apr 8 '13 #3
NeoPa
32,556 Expert Mod 16PB
Please check out Before Posting (VBA or SQL) Code before posting again.
Apr 9 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Phil Powell | last post by:
When I view the page (chat.php) in IE 6.0 the following code is utilized: if ($_COOKIE) { // OPEN UP A NEW WINDOW TO SHOW THE CHATROOM ob_start();...
8
by: Nick Coghlan | last post by:
Time for another random syntax idea. . . So, I was tinkering in the interactive interpreter, and came up with the following one-size-fits-most default argument hack: Py> x = 1 Py> def...
3
by: andrewcw | last post by:
The following function fails if the Jet database has a password. This is the error: {"Cannot start your application. The workgroup information file is missing or opened exclusively by another...
2
by: JIM.H. | last post by:
Hello, The following code fails at Response.Write(result.Properties("mail")(0)) if myUser does not have anything in the e-mail filed of active directory. The message I am getting is “Object...
9
by: BoloBaby | last post by:
I have an extremely vexing problem occurring in a program that I am writing. Consider the following block of code: Dim pDancer As New BEDancer mintIndex = mintIndex + 1 pDancer.DancerName =...
8
by: Jack | last post by:
Hi, This code I inherited worked under VC7 now fails under VC8 with error: error C2664: 'memcpy' : cannot convert parameter 1 from 'std::_Vector_iterator<_Ty,_Alloc>' to 'void *' vector...
3
by: BBM | last post by:
Hi everyone, This is probably a truly stupid question, but here goes. I'm trying to use the VB version of an application framework. I'm sure it works. I've been using the C# version for...
1
by: Jon Paal | last post by:
can someone tell me why this code fails in IE but works in Firefox <input type="text" id="searchstring" name="searchstring" size="10" value="Search" onFocus="this.value='';"> <a...
14
by: Vlad Dogaru | last post by:
Hello, I am trying to learn C, especially pointers. The following code attempts to count the appearences of each word in a text file, but fails invariably with Segmentation Fault. Please help me...
2
by: Philipp Reh | last post by:
Dear group, I recently tried to port some of my code to a VC++8.0 environment. I noticed that some boost::enable_if related code fails to compile there which works under gcc. I've made a...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.