473,654 Members | 3,062 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing one field in an updateable query to a new value on a form--without querying

HI:

I have a situation where I wish to enter a value in an unbound field on a form and then
change the same field in each record on the form so that it reflects the value entered.
THe form is suppored by an updatable query (linked to a table). I would rather not use a
query approach because it will result in a need for a new form and will create its own
complications (although this could be done) I would like to make the change so that it
reflects immediately on the form in each record. I am working with macros to accomplish
this, and am having a few problems when i get to the end of the table (somehow I am
running off the end).

Can anyone suggest an easy, non query, method to accomplish this?

Regards

John Baker
Nov 12 '05 #1
6 1881
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If I understand you correctly, you can probably use the Control's
AfterUpdate event procedure to set the DefaultValue to whatever the
user entered. E.g.:

Private Sub MyControl_After Update()

Me!MyControl.De faultValue = Me!MyControl.Va lue

End Sub

HTH,

MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP/eBvoechKqOuFEgE QIAxgCfU+uMNAiz jMNnEGaQ0/nVrcQ/AYUAoNuy
xpwLljpIFdSHJKO iqZIC+/Dc
=BF9A
-----END PGP SIGNATURE-----
John Baker wrote:
HI:

I have a situation where I wish to enter a value in an unbound field on a form and then
change the same field in each record on the form so that it reflects the value entered.
THe form is suppored by an updatable query (linked to a table). I would rather not use a
query approach because it will result in a need for a new form and will create its own
complications (although this could be done) I would like to make the change so that it
reflects immediately on the form in each record. I am working with macros to accomplish
this, and am having a few problems when i get to the end of the table (somehow I am
running off the end).

Can anyone suggest an easy, non query, method to accomplish this?

Regards

John Baker


Nov 12 '05 #2
John Baker wrote:
HI:

I have a situation where I wish to enter a value in an unbound field on a form and then
change the same field in each record on the form so that it reflects the value entered.
THe form is suppored by an updatable query (linked to a table). I would rather not use a
query approach because it will result in a need for a new form and will create its own
complications (although this could be done) I would like to make the change so that it
reflects immediately on the form in each record. I am working with macros to accomplish
this, and am having a few problems when i get to the end of the table (somehow I am
running off the end).

Can anyone suggest an easy, non query, method to accomplish this?

Regards

John Baker


In the afterupdate event of the textfield, you could call an update query. Example below

Dim strSQL As String
strSQL = "UPDATE Table1 SET Table1.Item1 = [Forms]![MainForm]![TextField];"
Docmd.RunSQL strSQL

You could create the update query in the query builder if you are working with macros and
call the query instead. The above query updates ALL Item1 fields in Table1. You may want
to add filters if necessary.

Nov 12 '05 #3
Thanks:

I tried that, and set it up thus:
Private Sub NewMod__AfterUp date()
Dim strSQL As String
strSQL = "UPDATE tblPOModsmaker SET tblPOModsmaker. MOD number =
[Forms]![Makemodq1]![NewMod#];"
DoCmd.RunSQL strSQL

End Sub
I am getting an error which says "Syntax error in update statement". Can you see the
syntax problem, because I cant!

Thanks

John

Salad <oi*@vinegar.co m> wrote:
John Baker wrote:
HI:

I have a situation where I wish to enter a value in an unbound field on a form and then
change the same field in each record on the form so that it reflects the value entered.
THe form is suppored by an updatable query (linked to a table). I would rather not use a
query approach because it will result in a need for a new form and will create its own
complications (although this could be done) I would like to make the change so that it
reflects immediately on the form in each record. I am working with macros to accomplish
this, and am having a few problems when i get to the end of the table (somehow I am
running off the end).

Can anyone suggest an easy, non query, method to accomplish this?

Regards

John Baker


In the afterupdate event of the textfield, you could call an update query. Example below

Dim strSQL As String
strSQL = "UPDATE Table1 SET Table1.Item1 = [Forms]![MainForm]![TextField];"
Docmd.RunSQL strSQL

You could create the update query in the query builder if you are working with macros and
call the query instead. The above query updates ALL Item1 fields in Table1. You may want
to add filters if necessary.


Nov 12 '05 #4
HI:

Thank you for the response.

Iam not into VBA much, so the syntax often escapes me:

The table I wish to change is called: tblPOmodsmaker
The field is: MOD number
I wish to change it to a value that is in a form called: Makemodq1
The field on that form (in an unbounded field) is called:Newmod#
Could you spell out how it would be setup using the AfterUpdate procedure.

Thanks a million

John

MGFoster <me@privacy.com > wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If I understand you correctly, you can probably use the Control's
AfterUpdate event procedure to set the DefaultValue to whatever the
user entered. E.g.:

Private Sub MyControl_After Update()

Me!MyControl.De faultValue = Me!MyControl.Va lue

End Sub

HTH,

MGFoster:::mgf 00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP/eBvoechKqOuFEgE QIAxgCfU+uMNAiz jMNnEGaQ0/nVrcQ/AYUAoNuy
xpwLljpIFdSHJK OiqZIC+/Dc
=BF9A
-----END PGP SIGNATURE-----
John Baker wrote:
HI:

I have a situation where I wish to enter a value in an unbound field on a form and then
change the same field in each record on the form so that it reflects the value entered.
THe form is suppored by an updatable query (linked to a table). I would rather not use a
query approach because it will result in a need for a new form and will create its own
complications (although this could be done) I would like to make the change so that it
reflects immediately on the form in each record. I am working with macros to accomplish
this, and am having a few problems when i get to the end of the table (somehow I am
running off the end).

Can anyone suggest an easy, non query, method to accomplish this?

Regards

John Baker


Nov 12 '05 #5
John Baker wrote:
Thanks:

I tried that, and set it up thus:

Private Sub NewMod__AfterUp date()
Dim strSQL As String
strSQL = "UPDATE tblPOModsmaker SET tblPOModsmaker. MOD number =
[Forms]![Makemodq1]![NewMod#];"
DoCmd.RunSQL strSQL

End Sub

I am getting an error which says "Syntax error in update statement". Can you see the
syntax problem, because I cant!

Thanks


Well....MOD is function that can get the modulus between 2 numbers. And I NEVER create
table/field names with spaces, dashes, underscores or whatever. Ex: You use Mod Number. I
use ModNumber. That way I avoid extra keystrokes (the need to surround by []'s) and
frankly...it looks better. But let's look at your statement.

Mod Number should be tblPOModsmaker.[MOD number].

If this was a query, it'd run fine. However, in VBA you need to parse data out so Access knows
what to do. Ex: Access flunks on [Forms]![Makemodq1]![NewMod#] when it is contained in the
string. It has NO idea what the heck that is. But...if you change it to
strSQL = "UPDATE tblPOModsmaker " & _
"SET tblPOModsmaker.[MOD number] = " & [Forms]![Makemodq1]![NewMod#]
then that should work....except if
newmod# is a string or date.

Ex "Where DateField = #" & Date & "#"
Ex: "Where MyName = '" & varName & "'"

Did you see where name is quote, single quote, quote. If you know that a text filed could
contain double or single quotes, you need to futz with that. There is discussion on quotes in
the Access Developers Guide. You can also check google for that.

In my example, I figure NewMod# is a number. No quotes or #'s are needed

Nov 12 '05 #6
Thank you vey much.

John baker

Salad <oi*@vinegar.co m> wrote:
John Baker wrote:
Thanks:

I tried that, and set it up thus:

Private Sub NewMod__AfterUp date()
Dim strSQL As String
strSQL = "UPDATE tblPOModsmaker SET tblPOModsmaker. MOD number =
[Forms]![Makemodq1]![NewMod#];"
DoCmd.RunSQL strSQL

End Sub

I am getting an error which says "Syntax error in update statement". Can you see the
syntax problem, because I cant!

Thanks


Well....MOD is function that can get the modulus between 2 numbers. And I NEVER create
table/field names with spaces, dashes, underscores or whatever. Ex: You use Mod Number. I
use ModNumber. That way I avoid extra keystrokes (the need to surround by []'s) and
frankly...it looks better. But let's look at your statement.

Mod Number should be tblPOModsmaker.[MOD number].

If this was a query, it'd run fine. However, in VBA you need to parse data out so Access knows
what to do. Ex: Access flunks on [Forms]![Makemodq1]![NewMod#] when it is contained in the
string. It has NO idea what the heck that is. But...if you change it to
strSQL = "UPDATE tblPOModsmaker " & _
"SET tblPOModsmaker.[MOD number] = " & [Forms]![Makemodq1]![NewMod#]
then that should work....except if
newmod# is a string or date.

Ex "Where DateField = #" & Date & "#"
Ex: "Where MyName = '" & varName & "'"

Did you see where name is quote, single quote, quote. If you know that a text filed could
contain double or single quotes, you need to futz with that. There is discussion on quotes in
the Access Developers Guide. You can also check google for that.

In my example, I figure NewMod# is a number. No quotes or #'s are needed


Nov 12 '05 #7

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

Similar topics

8
902
by: Tom wilson | last post by:
This is driving me nuts. I'm trying to update an Excel spreadsheet using ADO.Net and Oledb in VB.Net. The connection is open, the adapter is connected and the dataset is loaded. Here's the code in question: myDataRow = myDataSet.Tables(0).Rows(RowNum) myDataRow(ColumnCount) = Ailment Adapter.UpdateCommand = New OleDbCommand("UPDATE SET F" & ColumnCount & " = '" & Ailment & "' where F1 = " & RowNum & "", Conn)...
1
1334
by: turtle | last post by:
I have a need to update a table with the min date from another table. I have a query that has the min date for each group in one table. I want to pass this value into another table. I get an error saying that Operation must use an updateable query. I understand it won't update because my query has grouping. How do I get around this? Example Table 1 ID Date
4
302
by: Derek Van Cuyk | last post by:
Hi everyone! I'm trying to write a web application in school that utilizes a MS Access database. I can read and everything fine from it but when I try to add a new record I get an exception that states: "Operation must use an updateable query" I know it has to do with the update command on the OleDbDataAdapter. I've tried looking for the problem on the net and newsgroups but I don't seem to have the same problems as everyone else. Please,...
5
1533
by: Web Search Store | last post by:
I'm getting this error on my web page: Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) Operation must use an updateable query. /searchweb33.asp, line 5014 Here is the code producing it:
8
2998
by: Jim in Arizona | last post by:
I've been using an example out of a book to be able to edit the rows in a database. I am getting the following error: ======================================================== ======================================================== Server Error in '/' Application. -------------------------------------------------------------------------------- Operation must use an updateable query. Description: An unhandled exception occurred during...
1
3574
by: Muskito | last post by:
HELP!!! Hello All, I'm using VB.net 2003 and trying to update data in Excel worksheet. The program selects data from the excel, updates something in the MSSQL DB and then tries to update something back to the excel worksheet. My problem is that i'm having this annoying exception: "Operation must
11
3951
by: Arpan | last post by:
I have always been working with SQL Server 2005 for ASP.NET apps but due to some reasons, had to revert back to MS-Access 2000. When I try to insert/update a MS-Access DB table (MDB), ASP.NET generates the following error: Operation must use an updateable query. pointing to a line that says
4
15751
by: Mike D | last post by:
OS: Windows XP Professional Microsoft Access 2003 I am trying to update a table in my DB from a tempory table. I need to ensure that if records in the main table match records in the temp table (on the keys) they are replaced/updated by the new data in the temp table. the vba code i am running is below: Dim mySQL As String
2
1845
by: imnewtoaccess | last post by:
Hello everybody, I am completely new to access and am facing a problem. I am trying to run the following query from the query designer ( i am using access 2000 and the table that i am trying to update is created by me ) and I am getting the error 'Operation must use an updateable query' UPDATE ac_online_scanned_tkts_1 SET ac_online_scanned_tkts_1.Batch = ( Select Max (temp.batch) as t1 from ac_online_scanned_tkts_1 As temp ) WHERE...
5
3331
by: kpfunf | last post by:
The point of this query is to look at the transactions already entered and see if new transactions have occured and if there is a need to update the amount of the transaction. I have an update query that is running into the error: Operation must use an updateable query. UPDATE M_Transactions INNER JOIN Q_UMI ON (Q_UMI.TransDate = M_Transactions.TransactionDate) AND (M_Transactions.VendorID = Q_UMI.VendorID) SET M_Transactions.Debit = ....
0
8375
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8290
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8707
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6161
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2714
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1593
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.