473,508 Members | 2,344 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_pw).

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.OpenRecordset("tblAddresses")

rstAddresses_pw.FindFirst strFind_pw

If Not rstAddresses_pw.NoMatch Then

With rstAddresses_pw
Me.cboAddressType_pw = !AddressType
Me.txtAddress1_pw = !AddressLine1
Me.txtAddress2_pw = !AddressLine2
Me.txtCity_pw = !City
Me.txtState_pw = !StateAbbrev
Me.txtZipCode_pw = !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 1865
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******************@removespamcop.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_pw).

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.OpenRecordset("tblAddresses")

rstAddresses_pw.FindFirst strFind_pw

If Not rstAddresses_pw.NoMatch Then

With rstAddresses_pw
Me.cboAddressType_pw = !AddressType
Me.txtAddress1_pw = !AddressLine1
Me.txtAddress2_pw = !AddressLine2
Me.txtCity_pw = !City
Me.txtState_pw = !StateAbbrev
Me.txtZipCode_pw = !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_pw).

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.OpenRecordset("tblAddresses")

rstAddresses_pw.FindFirst strFind_pw

If Not rstAddresses_pw.NoMatch Then

With rstAddresses_pw
Me.cboAddressType_pw = !AddressType
Me.txtAddress1_pw = !AddressLine1
Me.txtAddress2_pw = !AddressLine2
Me.txtCity_pw = !City
Me.txtState_pw = !StateAbbrev
Me.txtZipCode_pw = !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******************@removespamcop.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_pw).

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.OpenRecordset("tblAddresses")

rstAddresses_pw.FindFirst strFind_pw

If Not rstAddresses_pw.NoMatch Then

With rstAddresses_pw
Me.cboAddressType_pw = !AddressType
Me.txtAddress1_pw = !AddressLine1
Me.txtAddress2_pw = !AddressLine2
Me.txtCity_pw = !City
Me.txtState_pw = !StateAbbrev
Me.txtZipCode_pw = !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
10544
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...
3
8579
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,...
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...
3
4921
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...
6
1431
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...
20
18313
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...
1
2272
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...
1
1559
by: komaladevi | last post by:
can any one help me in writing acode -"how to edit "edit item template" dynamically""
4
2877
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...
0
7135
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...
0
7410
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...
1
7067
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
7505
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
5650
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,...
1
5060
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...
0
4729
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...
0
1570
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 ...
0
440
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...

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.