473,668 Members | 2,360 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A2003: "Update or CancelUpdate without AddNew or Edit"

Hi,

I Googled the subject and couldn't find solution (DoCmd Save....
didn't work).

I tried this code in the Form's Open and Load. I am just trying to
populate UNBOUND fields on a form.

I get the error when closing out the form. None of the fields that I
am populating on the form are bound to a table (except for
..txtPersonID_p w).

Below is the code. Any ideas?

Dim dbCurr_pw As Database
Dim rstAddresses_pw As Recordset

Dim intPersonID_pw As Integer
Dim strFind_pw As String

intPersonID_pw = Me.txtPersonID_ pw
strFind_pw = "[personid] = " & intPersonID_pw

Set dbCurr_pw = CurrentDb()
Set rstAddresses_pw = dbCurr_pw.OpenR ecordset("tblAd dresses")

rstAddresses_pw .FindFirst strFind_pw

If Not rstAddresses_pw .NoMatch Then

With rstAddresses_pw
Me.cboAddressTy pe_pw = !AddressType
Me.txtAddress1_ pw = !AddressLine1
Me.txtAddress2_ pw = !AddressLine2
Me.txtCity_pw = !City
Me.txtState_pw = !StateAbbrev
Me.txtZipCode_p w = !ZipCode
Me.txtPhone1_pw = !PhoneNumber1
Me.txtPhone2_pw = !PhoneNumber2
Me.txtEmail_pw = !EmailAddress
.Close
End With

End If

Set rstAddresses_pw = Nothing

-pw

use paulwilliamson at spamcop dot net for e-mail
Nov 13 '05 #1
4 1875
It is because I updated a combobox, but I have no idea how to fix it!


On Thu, 26 May 2005 11:51:33 -0600,
pa************* *****@removespa mcop.net wrote:
Hi,

I Googled the subject and couldn't find solution (DoCmd Save....
didn't work).

I tried this code in the Form's Open and Load. I am just trying to
populate UNBOUND fields on a form.

I get the error when closing out the form. None of the fields that I
am populating on the form are bound to a table (except for
.txtPersonID_p w).

Below is the code. Any ideas?

Dim dbCurr_pw As Database
Dim rstAddresses_pw As Recordset

Dim intPersonID_pw As Integer
Dim strFind_pw As String

intPersonID_ pw = Me.txtPersonID_ pw
strFind_pw = "[personid] = " & intPersonID_pw

Set dbCurr_pw = CurrentDb()
Set rstAddresses_pw = dbCurr_pw.OpenR ecordset("tblAd dresses")

rstAddresses_p w.FindFirst strFind_pw

If Not rstAddresses_pw .NoMatch Then

With rstAddresses_pw
Me.cboAddressTy pe_pw = !AddressType
Me.txtAddress1_ pw = !AddressLine1
Me.txtAddress2_ pw = !AddressLine2
Me.txtCity_pw = !City
Me.txtState_pw = !StateAbbrev
Me.txtZipCode_p w = !ZipCode
Me.txtPhone1_pw = !PhoneNumber1
Me.txtPhone2_pw = !PhoneNumber2
Me.txtEmail_pw = !EmailAddress
.Close
End With

End If

Set rstAddresses_pw = Nothing

-pw

use paulwilliamson at spamcop dot net for e-mail


-pw

use paulwilliamson at spamcop dot net for e-mail
Nov 13 '05 #2
And the combobox IS a bound control, so I was wrong in my initial
post.

Still have no idea how to fix it though!

Hi,

I Googled the subject and couldn't find solution (DoCmd Save....
didn't work).

I tried this code in the Form's Open and Load. I am just trying to
populate UNBOUND fields on a form.

I get the error when closing out the form. None of the fields that I
am populating on the form are bound to a table (except for
.txtPersonID_p w).

Below is the code. Any ideas?

Dim dbCurr_pw As Database
Dim rstAddresses_pw As Recordset

Dim intPersonID_pw As Integer
Dim strFind_pw As String

intPersonID_ pw = Me.txtPersonID_ pw
strFind_pw = "[personid] = " & intPersonID_pw

Set dbCurr_pw = CurrentDb()
Set rstAddresses_pw = dbCurr_pw.OpenR ecordset("tblAd dresses")

rstAddresses_p w.FindFirst strFind_pw

If Not rstAddresses_pw .NoMatch Then

With rstAddresses_pw
Me.cboAddressTy pe_pw = !AddressType
Me.txtAddress1_ pw = !AddressLine1
Me.txtAddress2_ pw = !AddressLine2
Me.txtCity_pw = !City
Me.txtState_pw = !StateAbbrev
Me.txtZipCode_p w = !ZipCode
Me.txtPhone1_pw = !PhoneNumber1
Me.txtPhone2_pw = !PhoneNumber2
Me.txtEmail_pw = !EmailAddress
.Close
End With

End If

Set rstAddresses_pw = Nothing

-pw

use paulwilliamson at spamcop dot net for e-mail


-pw

use paulwilliamson at spamcop dot net for e-mail
Nov 13 '05 #3
Sorry guys! The combobox is Not a bound control (it's unbound).
Don't know what I was thinking.

Any way, how come populating a comobox in code causes this error
message when leaving the form (and not populating any of the bound
controls)?
On Thu, 26 May 2005 11:51:33 -0600, pa************* *****@removespa mcop.net wrote: Hi,

I Googled the subject and couldn't find solution (DoCmd Save....
didn't work).

I tried this code in the Form's Open and Load. I am just trying to
populate UNBOUND fields on a form.

I get the error when closing out the form. None of the fields that I
am populating on the form are bound to a table (except for
.txtPersonID_p w).

Below is the code. Any ideas?

Dim dbCurr_pw As Database
Dim rstAddresses_pw As Recordset

Dim intPersonID_pw As Integer
Dim strFind_pw As String

intPersonID_ pw = Me.txtPersonID_ pw
strFind_pw = "[personid] = " & intPersonID_pw

Set dbCurr_pw = CurrentDb()
Set rstAddresses_pw = dbCurr_pw.OpenR ecordset("tblAd dresses")

rstAddresses_p w.FindFirst strFind_pw

If Not rstAddresses_pw .NoMatch Then

With rstAddresses_pw
Me.cboAddressTy pe_pw = !AddressType
Me.txtAddress1_ pw = !AddressLine1
Me.txtAddress2_ pw = !AddressLine2
Me.txtCity_pw = !City
Me.txtState_pw = !StateAbbrev
Me.txtZipCode_p w = !ZipCode
Me.txtPhone1_pw = !PhoneNumber1
Me.txtPhone2_pw = !PhoneNumber2
Me.txtEmail_pw = !EmailAddress
.Close
End With

End If

Set rstAddresses_pw = Nothing

-pw

use paulwilliamson at spamcop dot net for e-mail


-pw

use paulwilliamson at spamcop dot net for e-mail
Nov 13 '05 #4
Nevermind! I think I found something wrong with the code I run when
the form unloads. Thanks to debug!

-paul
-pw

use paulwilliamson at spamcop dot net for e-mail
Nov 13 '05 #5

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

Similar topics

2
10549
by: Mark | last post by:
A beginner in this area, I have been able to read a record from a MySQL database and populate an HTML form (wow!). Now, my goal is to allow the user to edit the contents of the form and then update the record in MySQL. The problem is, as soon as the "Update" button (type="submit") is pressed, all of the data disappear from the form. How can that be prevented? Here is my code:
3
8584
by: Greg Bryant | last post by:
I'm doing some work for a company that has an auction site running in coldfusion. They're not real happy with it, and it needs a major overhaul, so I'm looking at redoing it, and while I'm at it, might as well move to PHP (for a variety of reasons - not trying to reopen the PHP -vs- CFM thing again :). Anyway, so I'm looking at this system, and there are no "scheduled tasks" (it's win2kas). How do you write a server app that needs to...
2
328
by: NewDBGirl | last post by:
I have a multiple-page form for entering info about a project with several sub-forms for sub-projects, notes and tasks. The form and one of the sub-forms each have a combo box to select a record to display, as well as a "last date/time updated" type of field that populates AfterUpdate. What can I do to fix the "Update or CancelUpdate without AddNew or Edit" error? I'm pretty unschooled in code but I have gotten by with macros and...
3
4928
by: Kevin Pedersen | last post by:
Hello, I am using an editable datagrid. After I save the changes the datagrid shows the old values. I've read the posts about the Page_Load and not binding the datagrid each time. The SQL that is being sent to the database is correct and the changes are eventually being made. If I refresh the page after the update then the new values appear. I noticed that when I put a breakpoint in my update handler everything works fine. When I take...
6
1445
by: Larry Woods | last post by:
I am trying to name my submenus (MainMenu control) and they show up in the menu dropdown...like they are O.K., but when I check my controls the names are still "MenuItemX". OTOH, the top-level menu items renamed just fine. What might I be doing wrong? TIA, Larry Woods
20
18344
by: Mark Harrison | last post by:
So I have some data that I want to put into a table. If the row already exists (as defined by the primary key), I would like to update the row. Otherwise, I would like to insert the row. I've been doing something like delete from foo where name = 'xx'; insert into foo values('xx',1,2,...);
1
2283
by: Benny Ng | last post by:
Dear All, Now I met one problem in the development of my one application. I have one ASP.NET page. It's for disply the information of customer. But now I have one new requirement. It's to combine the "Edit" and "Display" funtions into this page. (It means if user want to edit the customer information, this page would provided editing page to the user; If the user want to display the customer information, this page would providev the...
1
1568
by: komaladevi | last post by:
can any one help me in writing acode -"how to edit "edit item template" dynamically""
4
2894
by: justice750 | last post by:
Hi All, I am using a FormView control. The allows me to update records in the database. However, when a database field is null I can not update the field on the form. It works fine when the field is not a null value. I am not using any code behind (C#) to bind the data or manipulate the data. I have read that when there is a null value in the database that there is no record in the "dataset". Can anyone show me how to bind a value in the...
0
8378
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
8890
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8791
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...
0
7398
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
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
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2786
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
2
2018
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1783
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.