I have been using this forum to answer many questions regarding an Access database I am building (my first attempt at something like this - teaching myself as I go), and I've always been able to find solutions. My problem now has been addressed in other posts, but none of the solutions given are working for me.
The database will be used for tracking changes that I make to a customer's pricing, with forms based on queries that will allow me to review these changes at a determined interval, decide if the change is paying off, and then either Leave it, Change it Back, Modify It, or Give it More Time (review it again in the future).
The issue I am having now just popped up - it was working as of 2 days ago, but something changed and now it's not.
I have a form that calls a query, ReviewSearchRec ords, that shows records that are due to be reviewed this week, based on information put into the original record. On this form, the user inputs DateReviewed, ResultsSinceCha nge(memo), ActionToTake(4 choices based on a combo box), and ActionNotes(mem o). Depending on which ActionToTake is chosen, different things will occur, messages pop up, etc.
The problem is with ActionToTake="G ive It More Time". I have set it up so that when this selected and the record is saved, a new record will be inserted into the table with much of the same data as the original, with some data altered per user input via an InputBox, etc.
As I mentioned, this was working fine until recently. Now, I am receiving a RunTime 2105 You Can't Go To Specified Record, and the debugger takes me to the DoCmd.GoToRecor d , , acNewRec line.
To rule things out based on what I've read in other posts - the form is set to allow additions. I had most of the fields that were displayed set to Locked=Yes on the form because I didn't want these to be changed via this form. To be sure, I set all these to No, but still received same error.
I am running Access 2000. Any help would be appreciated. I am posting my entire BeforeUpdate code, even though some of it may not be needed. -
Private Sub Form_BeforeUpdate(Cancel As Integer)
-
If MsgBox("Save Changes?", vbYesNo + vbQuestion) = vbNo Then
-
Cancel = True
-
MsgBox ("Changes not saved. Click Undo Changes to return record to original settings, or save the record")
-
GoTo exitForm_BeforeUpdate
-
Else
-
If ActionToTake = "Give It More Time" Then
-
-
Dim promptWeeks As String
-
promptWeeks = InputBox("Enter number of additional weeks until next review", , "8")
-
-
If promptWeeks = "" Then
-
-
MsgBox ("If you want to have this record come up for review again in the future, you must enter the number of weeks until the next review")
-
GoTo exitForm_BeforeUpdate
-
End If
-
-
sStoreGroup = StoreGroup
-
sDate = DateReviewed
-
sWeeksToReview = WeeksToReview
-
sAccount = Account
-
sGLID = GLID
-
sRequestFrom = RequestFrom
-
sAccountToCopy = AccountToCopy
-
sOldDG = OldDG
-
sNewDG = NewDG
-
sLine1 = Line1
-
sUD1 = UD1
-
sLine2 = Line2
-
sUD2 = UD2
-
sLine3 = Line3
-
sUD3 = UD3
-
sLine4 = Line4
-
sUD4 = UD4
-
sLine5 = Line5
-
sUD5 = UD5
-
sNotes = Notes
-
-
-
DoCmd.GoToRecord , , acNewRec
-
-
StoreGroup = sStoreGroup
-
Date = sDate
-
WeeksToReview = promptWeeks
-
Account = sAccount
-
GLID = sGLID
-
RequestFrom = sRequestFrom
-
AccountToCopy = sAccountToCopy
-
OldDG = sOldDG
-
NewDG = sNewDG
-
Line1 = sLine1
-
UD1 = sUD1
-
Line2 = sLine2
-
UD2 = sUD2
-
Line3 = sLine3
-
UD3 = sUD3
-
Line4 = sLine4
-
UD4 = sUD4
-
Line5 = sLine5
-
UD5 = sUD5
-
Notes = "**Holdover from " & Date & " Review** " & sNotes
-
-
MsgBox "A New Record Has Been Added with a Date of " & Date & " so the the pricing can be reviewed in the future."
-
End If
-
-
-
If ActionToTake = "Change It Back" Then
-
MsgBox "Record updated, but not finalized. Please use the Action Required form from the Switchboard after feedback from the field to finalize this record."
-
End If
-
If ActionToTake = "Modify It" Then
-
MsgBox "Record updated, but not finalized. Please use the Action Required form from the Switchboard after feedback from the field to finalize this record."
-
End If
-
If ActionToTake = "Leave It As Is" Then
-
MsgBox "Record Updated and finalized."
-
End If
-
End If
-
-
exitForm_BeforeUpdate:
-
Exit Sub
-
-
End Sub
-
2 3435
Hi - Thanks for the quick reply.
Yes, it was working at one point, but after reading the link you posted, I guess I'm not sure how.
At one point, I believe I had this loaded into an OnClick event, but decided on the BeforeUpdate so that if the form was dirty, it would force the user to either save or undo before moving to the next record (using the navigation buttons) and just confirming the desire to save the changes if the button was clicked. I am almost positive that I switched this to a BeforeUpdate event some time ago, and that I have had it working (i.e. adding the new record properly) since I did this, but perhaps I am losing my mind (an entirely likely possibility).
To follow up, moving this to the AfterUpdate event made the Add Record part work, however it made the first part of my code useless, i.e. the confirmation that you want to save. To fix this, I split the code up and now have, as a BeforeUpdate event: -
Private Sub Form_BeforeUpdate(Cancel As Integer)
-
-
-
If MsgBox("Save Changes?", vbYesNo + vbQuestion) = vbNo Then
-
Cancel = True
-
MsgBox ("Changes not saved. Click Undo Changes to return record to original settings, or save the record")
-
GoTo exitForm_BeforeUpdate
-
-
End If
-
-
exitForm_BeforeUpdate:
-
Exit Sub
-
-
-
End Sub
-
And my AfterUpdate event is: -
Private Sub Form_AfterUpdate()
-
-
If ActionToTake = "Give It More Time" Then
-
-
Dim promptWeeks As String
-
promptWeeks = InputBox("Enter number of additional weeks until next review", , "8")
-
-
If promptWeeks = "" Then
-
-
MsgBox ("If you want to have this record come up for review again in the future, you must enter the number of weeks until the next review")
-
GoTo exitForm_AfterUpdate
-
End If
-
-
sStoreGroup = StoreGroup
-
sDate = DateReviewed
-
sWeeksToReview = WeeksToReview
-
sAccount = Account
-
sGLID = GLID
-
sRequestFrom = RequestFrom
-
sAccountToCopy = AccountToCopy
-
sOldDG = OldDG
-
sNewDG = NewDG
-
sLine1 = Line1
-
sUD1 = UD1
-
sLine2 = Line2
-
sUD2 = UD2
-
sLine3 = Line3
-
sUD3 = UD3
-
sLine4 = Line4
-
sUD4 = UD4
-
sLine5 = Line5
-
sUD5 = UD5
-
sNotes = Notes
-
-
DoCmd.GoToRecord , , acNewRec
-
-
-
StoreGroup = sStoreGroup
-
Date = sDate
-
WeeksToReview = promptWeeks
-
Account = sAccount
-
GLID = sGLID
-
RequestFrom = sRequestFrom
-
AccountToCopy = sAccountToCopy
-
OldDG = sOldDG
-
NewDG = sNewDG
-
Line1 = sLine1
-
UD1 = sUD1
-
Line2 = sLine2
-
UD2 = sUD2
-
Line3 = sLine3
-
UD3 = sUD3
-
Line4 = sLine4
-
UD4 = sUD4
-
Line5 = sLine5
-
UD5 = sUD5
-
Notes = "**Holdover from " & Date & " Review** " & sNotes
-
-
MsgBox "A New Record Has Been Added with a Date of " & Date & " so the the pricing can be reviewed in the future."
-
-
End If
-
-
If ActionToTake = "Change It Back" Then
-
MsgBox "Record updated, but not finalized. Please use the Action Required form from the Switchboard after feedback from the field to finalize this record."
-
End If
-
If ActionToTake = "Modify It" Then
-
MsgBox "Record updated, but not finalized. Please use the Action Required form from the Switchboard after feedback from the field to finalize this record."
-
End If
-
If ActionToTake = "Leave It As Is" Then
-
MsgBox "Record Updated and finalized."
-
End If
-
-
exitForm_AfterUpdate:
-
Exit Sub
-
-
End Sub
-
This creates another problem, because once the new record is entered, I can't save the new record because of a 2115 runtime error, which, from the quick searching I have done on it, is because I am trying to save the new record when the BeforeUpdate event has already been triggered (due to saving the original record). I'll try to devise a solution to this and if I can't come up with anything will post a fresh question. This question, regarding the 2105 error, has been answered - thanks for your help.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Eric |
last post by:
What's the best way to cancel the new record when doCmd.GoToRecord , ,
acNewRec is executed and before the new record is actually written to
the database.
I'm maintaining an existing Access 97 application. The main order
form's recordsource is a query. On the form is an add button that uses
doCmd.GoToRecord , , acNewRec to display an empty record and place the
user in the first field.
If the user tabs out of the first field (assuming...
|
by: Timppa |
last post by:
Hi,
I'm converting ACCESS 2000 database to SQL Server. I have .adp
project.
In the .mdb I have form where I'll insert rows into two different
tables using docmd.GoToRecod ,,acNewRec.
In .adp form's Record source property I have following Stored
Procedure (in .mdb there were similar query).
|
by: David |
last post by:
I am trying to insert an employee number into the EmpNbr field in my
main table from a form where I add a new employee to my employee table.
I was hoping this command would work, but it isn't.
DoCmd.RunSQL "INSERT INTO VALUES ()", 0
This is the only field I want to populate in the main table from this
form. there are three other fields in the main table that I want to
leave unpopulated.
|
by: Stack |
last post by:
Hello,
I have my data sorted on date desc in my form (multiple recs/table
style). When I want to insert a new record (with my self made button
and vba code(DoCmd.GoToRecord , , acNewRec)) the prompt will go after
the last record of my form. Is there a way to insert BEFORE the first
record (so before the last inserted record) in top of my screen?
It would surprise me though!
Stack
|
by: sajid_yusuf |
last post by:
Hi
My MS-Access 2003 "Form" is bind to a SQL server 2000 table but I
wonder why doesn't it accept the following command and displays an
error that "You can't go to the specified record". It works well with
MS Access tables but creates problem when the backend table belongs to
SQL server :
DoCmd.GoToRecord , , acNewRec
| |
by: JAMBAI |
last post by:
Hi,
Is there a way to handle single quotes when inserting the records using the below do command. Or do I need to write Insert sql.
DoCmd.GoToRecord , , acNewRec
Thanks
Jambai
|
by: vostrixos |
last post by:
Hi all,i need some help
I'm working on a access project were i use a lot the docmd.gotorecord ,,next ..first ..last method and i use only once the DoCmd.GoToRecord , , acNewRec.Everything was fine until i had to change the pop up property in a form.When that property is set to "yes" i get the error message:
"you can't use the goto record action or method on an object in design view"
I don't get that.wich object is on design vew.Is it the...
|
by: martintallett |
last post by:
Help!
I am trying to replace the Access Find button functionality on an old database.
I can make it work when I use a basic form with bound fields and a button which shows a popup form which then finds the record the user wants then does a GoToRecord on the basic form.
However...
When I try to put this to work in the real world the form with the record context to GoToRecord is a subform and it only partially works.
|
by: phill86 |
last post by:
Hi I have a main form that holds records for scheduled meetings, date time location etc... in that form i have a sub form that has a list of equipment resources that you can assign to the meeting in the main form. I have two buttons in the sub form one for selecting and copying all the records and another for pasting the records this enables me to copy and paste the equipment resources from one scheduled meeting to another.
The buttons are...
|
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...
|
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,...
| |
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...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| | |