473,385 Members | 1,409 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.

Update or CancelUpdate without AddNew or Edit

14
I have an Unbound Menu Form that brings up all the records in the db by name after the user types into a Parameter window. The record Form ("Special Acceptance Form Letter") is launched when the User Double Clicks their selection. I've used this form before on TONS of db's, however, on this particular db I'm getting the Update or CancelUpdate without AddNew or Edit error after the record Form is opened and I try to move from one record to the next or make an Edit.

Additionally, the Main Switchboard opens ON TOP of my form. Grrrrr.

Funny thing is, it doesn't happen when I go to the Database Window and just open it from there. I can move from record to record, opening the form that way, no problem, so I don't know what to think. The code running my Unbound Box is:
Private Sub Like_Search_DblClick(Cancel As Integer)
'Dimension variables.
Dim formname As String, SyncCriteria As String
Dim frm As Form, rs As DAO.Recordset

'Set the formname to "IRF Input form," the form that will be
'synchronized (opened).
formname = "Special Acceptance Form Letter"

'Check to see if the Main form is open. If it
'is not open, open it.
If Not SysCmd(acSysCmdGetObjectState, acForm, formname) Then
DoCmd.OpenForm formname
End If

'Define the form object and Recordset object for
'the Main form.
Set frm = Forms(formname)
Set rs = frm.RecordsetClone

'Define the criteria used for the synchronization.

SyncCriteria = BuildCriteria("ID", dbLong, Me.Like_Search.Column(5))

'Synchronize the corresponding record in the form to
'the current record in the subform.

rs.FindFirst SyncCriteria

'If a record exists in the form, find the
'matching record.
If rs.NoMatch Then
MsgBox "No match exists!", 64, formname
Else
frm.Bookmark = rs.Bookmark
End If
DoCmd.Close acForm, "Customer Search Dialog"
Exit_ReportList_Click:
Exit Sub

Set rs = Nothing
End Sub

However, when I get the error and click DEBUG, it shows breaking on this line (Bolded) below:
Private Sub Form_BeforeUpdate(Cancel As Integer)
'*******************Prem Ops Mod**********************************
If Me.Prem_Ops_U_L_Mod_1 = 0 Then
[Prem/Ops U/L Manual 1] = [Prem/Ops U/L Prem 1]
Else
[Prem/Ops U/L Manual 1] = ([Prem/Ops U/L Prem 1] / [Prem/Ops U/L Mod 1])
End If

If Me.Prem_Ops_U_L_Mod_2 = 0 Then
[Prem/Ops U/L Manual 2] = [Prem/Ops U/L Prem 2]
Else
[Prem/Ops U/L Manual 2] = ([Prem/Ops U/L Prem 2] / [Prem/Ops U/L Mod 2])
End If

If Me.Prem_Ops_U_L_Mod_3 = 0 Then
[Prem/Ops U/L Manual 3] = [Prem/Ops U/L Prem 3]
Else
[Prem/Ops U/L Manual 3] = ([Prem/Ops U/L Prem 3] / [Prem/Ops U/L Mod 3])
End If

'*******************Prem Ops Mod 1 **********************************
Dim Effective_Date As Date
If Me.Effective_Date >= #1/1/2010# And Me.Effective_Date <= #12/31/2010# Then
[Prem/Ops Manual XS 1] = ([Prem/Ops U/L Manual 1] * 0.09)
[Prem/Ops Prem 1] = [Prem/Ops Manual XS 1] * [Prem/Ops Mod 1]

ElseIf Me.Effective_Date >= #1/1/2011# And Me.Effective_Date <= #12/31/2011# Then
[Prem/Ops Manual XS 1] = ([Prem/Ops U/L Manual 1] * 0.09)
[Prem/Ops Prem 1] = [Prem/Ops Manual XS 1] * [Prem/Ops Mod 1]

ElseIf Me.Effective_Date >= #1/1/2012# And Me.Effective_Date <= #12/31/2012# Then
[Prem/Ops Manual XS 1] = ([Prem/Ops U/L Manual 1] * 0.09)
[Prem/Ops Prem 1] = [Prem/Ops Manual XS 1] * [Prem/Ops Mod 1]

End If

'*******************Prem Ops Mod 2**********************************

If Me.Effective_Date >= #1/1/2010# And Me.Effective_Date <= #12/31/2010# Then
[Prem/Ops Manual XS 2] = ([Prem/Ops U/L Manual 2] * 0.13)
[Prem/Ops Prem 2] = [Prem/Ops Manual XS 2] * [Prem/Ops Mod 2]

ElseIf Me.Effective_Date >= #1/1/2011# And Me.Effective_Date <= #12/31/2011# Then
[Prem/Ops Manual XS 2] = ([Prem/Ops U/L Manual 2] * 0.13)
[Prem/Ops Prem 2] = [Prem/Ops Manual XS 2] * [Prem/Ops Mod 2]

ElseIf Me.Effective_Date >= #1/1/2012# And Me.Effective_Date <= #12/31/2012# Then
[Prem/Ops Manual XS 2] = ([Prem/Ops U/L Manual 2] * 0.13)
[Prem/Ops Prem 2] = [Prem/Ops Manual XS 2] * [Prem/Ops Mod 2]

End If

'*******************Prem Ops Mod 3 **********************************

If Me.Effective_Date >= #1/1/2010# And Me.Effective_Date <= #12/31/2010# Then
[Prem/Ops Manual XS 3] = ([Prem/Ops U/L Manual 3] * 0.2)
[Prem/Ops Prem 3] = [Prem/Ops Manual XS 3] * [Prem/Ops Mod 3]

ElseIf Me.Effective_Date >= #1/1/2011# And Me.Effective_Date <= #12/31/2011# Then
[Prem/Ops Manual XS 3] = ([Prem/Ops U/L Manual 3] * 0.2)
[Prem/Ops Prem 3] = [Prem/Ops Manual XS 3] * [Prem/Ops Mod 3]

ElseIf Me.Effective_Date >= #1/1/2012# And Me.Effective_Date <= #12/31/2012# Then
[Prem/Ops Manual XS 3] = ([Prem/Ops U/L Manual 3] * 0.2)
[Prem/Ops Prem 3] = [Prem/Ops Manual XS 3] * [Prem/Ops Mod 3]

End If

'*************************************Prods******* ******************

If [Prods U/L Mod A] = 0 Then
[Prods U/L Manual A] = [Prods U/L Prem A]
Else
[Prods U/L Manual A] = ([Prods U/L Prem A] / [Prods U/L Mod A])

End If

If [Prods U/L Mod B] = 0 Then
[Prods U/L Manual B] = [Prods U/L Prem B]
Else
[Prods U/L Manual B] = ([Prods U/L Prem B] / [Prods U/L Mod B])

End If

If [Prods U/L Mod C] = 0 Then
[Prods U/L Manual C] = [Prods U/L Prem C]
Else
[Prods U/L Manual C] = ([Prods U/L Prem C] / [Prods U/L Mod C])

End If
'*******************Prods A*****************************************

If Me.Effective_Date >= #1/1/2010# And Me.Effective_Date <= #12/31/2010# Then
[Prods Manual XS A] = ([Prods U/L Manual A] * 0.1)
[Prods Prem A] = [Prods Manual XS A] * [Prods Mod A]
End If

'*******************Prods B*****************************************
If Me.Effective_Date >= #1/1/2010# And Me.Effective_Date <= #12/31/2010# Then
[Prods Manual XS B] = ([Prods U/L Manual B] * 0.15)
[Prods Prem B] = [Prods Manual XS B] * [Prods Mod B]
End If
'*******************Prods C*****************************************
If Me.Effective_Date >= #1/1/2010# And Me.Effective_Date <= #12/31/2010# Then
[Prods Manual XS C] = ([Prods U/L Manual C] * 0.22)
[Prods Prem C] = [Prods Manual XS C] * [Prods Mod C]
End If

'*************************************Auto******** *****************

If [AL U/L Mod] = 0 Then
[AL Manual] = [AL U/L Prem]
Else
[AL U/L Man] = ([AL U/L Prem] / [AL U/L Mod])

End If

'*******************Prods A*****************************************

If Me.Effective_Date >= #1/1/2010# And Me.Effective_Date <= #12/31/2010# Then
[AL Man XS] = ([AL U/L Man] * 0.1)
[AL Prem] = [AL Man XS] * [AL Mod]
End If
End Sub

I'm sure it's something simply but I can't work myself around it cuz I don't know much VBA....can someone please take a look?

big THANKS,
LB in GA
Mar 25 '10 #1
1 1680
LBinGA
14
I believe I've figured this out.

I had a SetValue Macro running to calcuate totals on fields that I was using VBA to calculate data. Anyway, I removed all the SetValue references, moved all the calculations into VBA and I can use the Unbound form to open the records form and make edits now.

After only 5 or so hours....sheesh.

Thought I'd post the solution to my problem in case anyone else had this.

LB in GA
Mar 30 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: JSMiami | last post by:
I have a form that has the navigation buttons enabled. I have a procedure that runs every time a new record is loaded (Current Event). This procedure performs a SELECT from a table (different from...
2
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...
4
by: Stephen | last post by:
Hello People, Using MS Access 2003 VBA I get the error 3020 Update or CancelUpdate without AddNew or Edit when I run through the following code. Can anyone help suggest anything to try? Thanks....
0
by: crispywafers | last post by:
Hi, Hope someone can help me out. I have a piece of code I use to update a subforms numbers (Trimester Invoices) if the mainform numbers (School Year Order) change. What is interesting is the...
2
by: DaveN | last post by:
Hi all, I'm trying to update a record in a table with data from text boxes on a form. As a background to this, I managed to add a new record to the table in a similar manner with the following:...
2
by: bbasberg | last post by:
I have been working hard to clean up my code but I am still wondering why all incoming records go to the "AddNew" part of the IF statement and never to the Edit alternative. I believe that it must be...
9
bhcob1
by: bhcob1 | last post by:
Hey guys, 'Update or CancelUpdate without AddNew or Edit' On my database i keep occasionly get this error when i try and edit a field, it is not everytime. It will be working fine and then this...
9
anastasius
by: anastasius | last post by:
I have read other posts with a similar problem but I have not read of one like this. When a user selects a name from the drop-down list called "cboLastName" (which is unbound and whose...
5
by: fieldling | last post by:
I've written the following code to update a recordset but when I run it I get a Run-time error 3020: Update or CancelUpdate without AddNew or Edit. When I debug it highlights the rs.update line. I've...
7
by: troy_lee | last post by:
I have an unbound form. I have an Add New procedure that saves a new record to the database. What is the best way to update an existing record? In other words, clicking my "Submit record" button...
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
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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.