By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,256 Members | 1,663 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,256 IT Pros & Developers. It's quick & easy.

A2003: "Update or CancelUpdate without AddNew or Edit"

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.