Home > Visual Basic > Visual Basic Runtime Error 3022

Visual Basic Runtime Error 3022

I have not created the table myself but i found out the specific column that triggers the error. But without knowing what your form/table/query/procedure contains it is not possible to recommend something more. Login. rst!FileName=getFileName(txtPath.Value)'Storesthefilename. Source

Then I will take that autonumber ID and append it to a string, other words if the autonumber is 100, my string will be "XY-0100" and so on. If you are using an INSERT query, post the actual SQL code you are trying to use. For Variants yes, isn't initialiased hence it will be "empty". Solved Getting Run-time error 3022 on acCmdSaveRecord Posted on 2014-05-22 Programming Languages-Other Visual Basic Classic 2 Verified Solutions 4 Comments 527 Views Last Modified: 2014-05-28 The reason I'm closing my form

I just looked again and found that the foreign key field was also indexed but to allow duplicates. HTH Alan PS - Thanks for the reference for MS LOL Edited by: Access_Addict_Newbie on Wed Jan 4 12:20:14 EST 2006. Please Wait...

So you can do a "acCmdSaveRecord" at any time anywhere without the code after it (except the close if you want) because this will automatically trigger the BeforeUpdate event. Unfortunately, changing the rst.Update line so that it falls on the same conditional level doesn't change anything. Generally though you're better off setting the primary key of your tables to be an AutoNumber datatype which will get rid of your error. Just turned the indexing back on for that column - that now works as well...

For arguements sake lets say this field is vStudentID and that this field will take either the SSN# or an instutional generated number, and you are trying to add a record To start viewing messages, select the forum that you want to visit from the selection below. Quote: plus a Yes (No Duplicates) index? vbaInet View Public Profile Find More Posts by vbaInet

07-08-2010, 09:31 AM #3 Michael.K Registered User Join Date: Oct 2007 Posts: 5 Thanks: 0 Thanked

I have pretty much the same code for adding new data to other tables that also have autonumbers/primary keys. vbaInet View Public Profile Find More Posts by vbaInet 07-09-2010, 11:59 AM #7 boblarson Former Moderator Join Date: Jan 2001 Location: Oregon, USA Posts: Quite a slight typo there Quote: Originally Posted by boblarson ...(perhaps and only if the function is set to do so). In addition, the code that I am modifying (that someone else wrote with no documentation, naturally) has code in that 'grabs' the current value of TaskNo after going to the end

rst.AddNew'Preparerecordsetforanewrecord. A weird and spooky clock Should the sole user of a *nix system have two accounts? if they match it would produce table1.* and table2.* if they didn't match it would display table1.* and nullnull and table2.* RE: VB Run-time error 3022 MrThompson (IS/IT--Management) (OP) 29 Oct For Variants yes, isn't initialiased hence it will be "empty".

Join & Ask a Question Need Help in Real-Time? this contact form Positional Bathroom Etiquette Which is the most acceptable numeral for 1980 to 1989? End If rsCustomer.MoveNext End If Apr 11 '11 #4 reply Expert Mod 100+ P: 2,316 TheSmileyCoder Do you have a key column for your table?

However if I delete that line and add another "first" record I can see that the Autonumber field is actually changed, so my code is working (just not the way I leaving the record in a continous form or changing the focus from a subform to a mainform, closing the form and so on. boblarson View Public Profile Visit boblarson's homepage! http://gmailpush.com/visual-basic/visual-basic-runtime-error-365.html MsgBox"Fileuploaded.",vbInformation'Confirmtotheuserthatthefilewasuploaded.

vbaInet View Public Profile Find More Posts by vbaInet « Previous Thread | Next Thread » Thread Tools Show Printable Version Email this Page Display Modes What is mathematical logic? Can anyone offer any solutions to either fixing, trapping or bypassing this error?

Once I changed to Not Indexed and Not required everything works like a charm.

The error message is: Run-time error '3022': The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. There must be an index or a relation that you believe is innocuous but is actually the cause of the error. They all work!! However the recordset is re-opened upon clicking the save button, so this surely should flag remove the file from the recordset?

Does that make sense? Thanks for the info, I shall have to do some more reading! ms-access-2010 share|improve this question asked Nov 24 '13 at 20:53 Stamatis Liatsos 548 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted No offense intended, Check This Out any suggestions on where to look to find out what's wrong?many thanks,smarbu in nevada Alan_GView Member Profile Jan 3 2006, 03:37 PM Post#2Utterly Yorkshire and Forum/Wiki EditorPosts: 16,517Joined: 12-January 03From: Devon

If you apply for a job at the help desk at Microsoft, I'll be glad to give you a good reference!!!How for the specifics I didn't include in the last message: Reply With Quote Quick Navigation Database Development Top Site Areas Settings Private Messages Subscriptions Who's Online Search Forums Forums Home Forums Visual Basic Visual Basic .NET VB.net CodeBank Visual Basic 6 Find More Posts by boblarson 07-09-2010, 04:21 PM #11 vbaInet AWF VIP Join Date: Jan 2010 Location: U.K. At the end of the procedure I will take the autonumber ID for "XY-0100" and write it back to my first table, which will serve as an audit table.

The ones you recommended were:ccess BibleAccess Developers handbook (part 1 and 2)SQL for Mere MortalsWould it be possible to get the Author's name, Publisher and/or the ISBN for these books?many thanks,scott Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again. Right now the only way I can get round the problem is to put an On Error Resume Next. hahahahaha.

In the dialog box that appears, place a checkmark beside the table in question and then click the "Options..." button. Change the datatype of the primary key (to Number)? Why is the FBI making such a big deal out Hillary Clinton's private email server? What happens to all of the options when they expire?

The time now is 23:56. Thanks againSteve Thompson Red Flag This Post Please let us know here why this post is inappropriate. Starting with a precise definition, along with clear business goals, is essential. Would it not be more appropriate to use an AutoNumber - would it solve some of these issues you are coming across?

Apr 14 '11 #11 reply Message Cancel Changes Post your reply Join Now >> Sign in to post your reply or Sign up for a free account. rsGLClass!CustType = rsCustomer!Type rsGLClass!GLAcct = "Unknown" rsGLClass.Update Is there any way to bring an egg to its natural state (not boiled) after you cook it? No again.

Posts: 26,373 Thanks: 0 Thanked 2,403 Times in 2,372 Posts Re: Run-time error 3022 with .AddNew A sub and a function are literally the same except that the latter returns a I've now gotten the code to put multiple Actors for each Program into the ProgramActorJoin TableA. Results 1 to 2 of 2 Thread: RUN-TIME Error 3022 Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode