473,385 Members | 1,673 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,385 software developers and data experts.

SQL Syntax: Can anyone help?

Hi All

Access 2007 Windows XP

I have a table called:
UsystblApplication

Which has 2 fields called:
1. FieldName
2. Number

I want to be able to Update the reccord from a form which
has a control called:
1. Me.txtLastUsedRecordProject

And do it from a Command Button. I am using the code below,
and although I get the warning that I won't be able to undo it.
It just doesn't not alter. Here is the code I am using
Can anyone help?

Private Sub CmdLastUsedRecord_Click()

Dim strSQL As String
strSQL = "UPDATE UsystblApplication SET [Number]= " _
& txtLastUsedRecordProject _
& " WHERE UsystblApplication.Number= &
Me.txtLastUsedRecordProject"
DoCmd.RunSQL

End Sub

Apr 24 '07 #1
2 1712
You didn't give the SQL statement to the RunSQL command:

Private Sub CmdLastUsedRecord_Click()

Dim strSQL As String
strSQL = "UPDATE UsystblApplication SET [Number]= " _
& txtLastUsedRecordProject _
& " WHERE UsystblApplication.Number= &
Me.txtLastUsedRecordProject"
DoCmd.RunSQL strSQL

End Sub

By the way, our recommendation here would be to use the .Execute method of
the CurrentDb object because it will let you trap for errors:
Private Sub CmdLastUsedRecord_Click()

Dim strSQL As String
Dim dbs As DAO.Database
strSQL = "UPDATE UsystblApplication SET [Number]= " _
& txtLastUsedRecordProject _
& " WHERE UsystblApplication.Number= &
Me.txtLastUsedRecordProject"
Set dbs = CurrentDb
dbs.Execute strSQL, dbFailOnError
dbs.Close
Set dbs = Nothing

End Sub
--

Ken Snell
<MS ACCESS MVP>

"bobdydd" <re**************@yahoo.co.ukwrote in message
news:11**********************@o40g2000prh.googlegr oups.com...
Hi All

Access 2007 Windows XP

I have a table called:
UsystblApplication

Which has 2 fields called:
1. FieldName
2. Number

I want to be able to Update the reccord from a form which
has a control called:
1. Me.txtLastUsedRecordProject

And do it from a Command Button. I am using the code below,
and although I get the warning that I won't be able to undo it.
It just doesn't not alter. Here is the code I am using
Can anyone help?

Private Sub CmdLastUsedRecord_Click()

Dim strSQL As String
strSQL = "UPDATE UsystblApplication SET [Number]= " _
& txtLastUsedRecordProject _
& " WHERE UsystblApplication.Number= &
Me.txtLastUsedRecordProject"
DoCmd.RunSQL

End Sub

Apr 24 '07 #2
On Apr 25, 4:20 am, bobdydd <reallyuseful2...@yahoo.co.ukwrote:
Hi All

Access 2007 Windows XP

I have a table called:
UsystblApplication

Which has 2 fields called:
1. FieldName
2. Number

I want to be able to Update the reccord from a form which
has a control called:
1. Me.txtLastUsedRecordProject

And do it from a Command Button. I am using the code below,
and although I get the warning that I won't be able to undo it.
It just doesn't not alter. Here is the code I am using
Can anyone help?

Private Sub CmdLastUsedRecord_Click()

Dim strSQL As String
strSQL = "UPDATE UsystblApplication SET [Number]= " _
& txtLastUsedRecordProject _
& " WHERE UsystblApplication.Number= &
Me.txtLastUsedRecordProject"
DoCmd.RunSQL

End Sub
1. What is the value of Me!txtLastUsedRecordProject ?

2. Try this:

strSQL = "UPDATE UsystblApplication SET [Number]= " & _
txtLastUsedRecordProject & _
" WHERE UsystblApplication.Number= " & _
Me!txtLastUsedRecordProject

3. Are you updating the correct field?

Bubbles
Apr 26 '07 #3

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

Similar topics

14
by: Uwe Mayer | last post by:
Hi, I know the python community is not very receptive towards extending the python syntax. Nevertheless I'd like to make a suggestion and hear your pro and cons. I want so suggest a...
3
by: KevLow | last post by:
Hi, Hope some kind soul can help me out here.. I'm trying to programmatically modify the column headings of a crosstab query such that it can be dynamic based on user specified period (Month...
11
by: Mark Findlay | last post by:
Hello Experts! I am attempting to use the OleDbCommand.ExecuteScaler() function within my ASP.NET C# web page to perform a simple validation, but receive the following error: "Incorrect...
2
by: ROBERT MELLOTT | last post by:
I am currently using VB 6.0 so I hope someone out there can help me. All I need is the proper syntax to reference the paramter in a SQL query. Here is my problem. I created a dataenvironment...
8
by: Rich | last post by:
Hello, If I leave Option Strict Off I can use the following syntax to read data from a Lotus Notes application (a NotesViewEntry object represents a row of data from a Lotus Notes View - like a...
5
by: DIBS | last post by:
I'm new to Python and I don't understand what I'm doing wrong. I'm running windows xp. In the command line window, I type: Python Sudoku.py and I get the response" SyntaxError: invalid...
7
by: Mark Hobley | last post by:
I have some information that states that the if conditional can be be inverted from the traditional syntax if (EXPRESSION) BLOCK to an alternative syntax: if BLOCK (EXPRESSION); I have a...
3
by: jared.pohl | last post by:
Hi guys.. When I try and run the following code it says that there is a missing operator.. SELECT curr.portfolio_code, curr.date, (curr.gross_index-mo1.gross_index)/mo1.gross_index AS...
1
by: MCWarrior76 | last post by:
got a question for anyone that can help......im writin a game program for my nephew, and came across a problem, I wrote, if((TR=='a')&&(dresser_pick=='b')) || ((TR=='a')&&(dresser_pick2=='b')) it...
2
by: Sean Hammond | last post by:
Anyone understand this? Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02) on linux2 Type "help", "copyright", "credits" or "license" for more information. .... """Send 'input' (string) to the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.