Modules & VBA :: Hash Deleted And Autoincrement By 2
Sep 15, 2014
When I have a record that I copy and paste into a new record with one column having a unique constraint , I display message "Cannot insert duplicate code" then if not all values in the record are inserted , I get a #deleted in all columns
Refreshing , I find that the id is incremented by 2 instead of one.
That is if the previous record has ID 20 , the #deleted record has ID 22 .
How to avoid the #deleted which happens if not all columns are filled.
When I copy an entire record and paste it in a new record , I first get a duplicate issue with one of the columns(unique key constraint) and when I attempt to change the column value so as not to be duplicate ...I get a #deleted for the whole record.
This does not happen when I copy the unique column from a record and paste it then change (copying that column alone).
What could be the best explanation for this and how can I attempt this issue?
I've got a bit of a problem with # mark when I want to search a number containing "#". The number is as follows: 33.#5hy4-1234When I insert a part of this number to a textbox eg. #5hy to search records containg it, it gives me no results (despite there are such in a database) I know that it is to do with this # mark. I have an sql query: (...) where sachnummer like '*" & variable & "*'
Is there a way in MS Access to keep an autoincrment field counting successivly after deleting and inserting? I want the field having the right counting.
I have a database that a client of mine has started to create. He wants to be able to import data from an excel spreadsheet into a table in Access. I created a macro that works fine but now I am having an issue with importing additional data.
His excel sheets consist of Agency ID numbers, first name, last name, SSN, etc. He also has a column in the table called order number and internal ID. Which I duplicated in the spreadsheet. He wants the internal ID to autonumber. When I first use the macro to import the spreadsheet into Access it numbers the rows accordingly (after I fill the excel sheet using the series option). However, when I try to import an additional spreadsheet (which is a test sheet)I have to fill in the Internal ID number manually and consecutively according to the last record in access.
The sample spreadsheet he sent me has 2079 records which imported fine with the macro and then I made a second spreadsheet with two rows with information in them and if I don't put in the numbers 2080 and 2081 it imports them at the top of the table without any number in the internal ID. I hope this is making sense.
Can anybody help me make it so that it automatically puts a number (consecutively)in the internal ID field when I use the macro to import another spreadsheet.
Thanks in advance
Tracy
P.S. When I go to the order details table in design view it says that field is autonumber. If I do not assign a value to the Internal ID field in the spreadsheet it comes up with an import error saying that the fields had a null value but if I number the internal ID field manually in the spreadsheet it imports just fine. I don't want to manually input numbers into the internal ID field in the spreadsheet, I want access to do that for me but it won't let me.
I have a database that a client of mine has started to create. He wants to be able to import data from an excel spreadsheet into a table in Access. I created a macro that works fine but now I am having an issue with importing additional data.
His excel sheets consist of Agency ID numbers, first name, last name, SSN, etc. He also has a column in the table called order number and internal ID. Which I duplicated in the spreadsheet. He wants the internal ID to autonumber. When I first use the macro to import the spreadsheet into Access it numbers the rows accordingly (after I fill the excel sheet using the series option). However, when I try to import an additional spreadsheet (which is a test sheet)I have to fill in the Internal ID number manually and consecutively according to the last record in access.
The sample spreadsheet he sent me has 2079 records which imported fine with the macro and then I made a second spreadsheet with two rows with information in them and if I don't put in the numbers 2080 and 2081 it imports them at the top of the table without any number in the internal ID. I hope this is making sense.
Can anybody help me make it so that it automatically puts a number (consecutively)in the internal ID field when I use the macro to import another spreadsheet.
Thanks in advance
Tracy
P.S. When I go to the order details table in design view it says that field is autonumber. If I do not assign a value to the Internal ID field in the spreadsheet it comes up with an import error saying that the fields had a null value but if I number the internal ID field manually in the spreadsheet it imports just fine. I don't want to manually input numbers into the internal ID field in the spreadsheet, I want access to do that for me but it won't let me.
I've a button that position the table on a new record:
DoCmd.GoToRecord , , acNewRec
And I create a button to cancel that action:
Me.Undo
But the code field (autoincrement) continues autoincrementing! Explaning:
1. I click on "Add" button 2. The table's positioned on autoincrement code #1 3. I click on "Cancel" button 4. The register is cancelled, it isn't includded on table 5. I click on "Add" button 6. The table's positioned on autoincrement code #2 and the #1 isn't exists...
I had an inquiry from a semi paranoid client regarding retrieval of deleted data within an Access mdb. In Windows if you delete a file from the hard disk then most probably this file is only marked as deleted, but is not actually deleted until something is written over he space that the file occupied and is recoverable.
In an Access mdb file if we delete a record and do not perform any write action, is there any chance that the deleted record is only marked for deletion and can be recovered? Would compact make the deleted record non-recoverable? Is there any other way to make sure that when something is deleted that it is not recoverable?
I have a database that was populated using many excel sheets and one of the fields [partDescription] uses the # character over and over to represent "lbs". I realize that this is a wild card for digits in VB. Is there a quick fix for finding and replacing this character?
I have a database which is slowly evolving. Users needed a feature to delete some records without a trail and some with a trail from the form. So I added an apply action field in the subform using which they can delete a record without a trail and if they wanted to keep a trail they could do that too. When user selects "Delete Violations as it was entered in error" the system deletes the record completely which is what everyone wanted.
After six months of use now I am asked to add an audit trail. I managed to do that also. I also looked at Browne's method but my data structure does not match the requirements for that method. I used an alternate method. It works as intended except when a record is completely deleted using the code I mentioned above. Then it goes in the infinite loop. I somehow need to bypass the before update event so that the function to write the audit trail is not called.
I am using asp and database to store info for example link addresses. Unfortunately, they have become stored in database column with a # on either side. I have tried find and replace but this does not work on # symbol. It can not be stored as a hyperlink because I need my website to extract info from remote database and then display info in results page as a hyperlink. Works fine if I remove them by hand but there are 3000 of them!
I have a command button on a Web Mutli-Record form that is using a "= [Report_URL]" value within the Hyperlink Address property. This all seems to work other than the fact that when the link popups up it has a "#" on either side that basically makes it an invalid address. How do I get rid of the # signs to get the web address popup in the URL when a user clicks on the Command Button that is associated to the row the record is on.
The BE of my db is located at my PC. FE are then accessed by 3 of my staff on a shared folder. To check how high the security of my dbase is, i opened the folder where the BE lies on one of the user's workstation and tried to delete it. Can't believe IT WAS DELETED!!! Why??? It should have been addressed by "User-Level Security Wizard", right??? I'm using Windows XP, Office 2003.
I am so stupid! I just deleted the whole code for a form!! I had two days of work in it! I was creating a new form similar in layout to the original and had copy-pasted. i then deleted all the code from one of them, and then the other one by mistake!
Does windows store this stuff temporarily anywhere? can someone please help!??
I enter records into MS Access and then when I close it and reopen it, every once in awhile records that I entered previously are deleted. I am new to Access so it may be a simple problem such as saving the database but it is extremely frusturating when I enter customers into a database and then reopen it to find out voila half the customers I entered are not there. If anyone can help me it would be really appreciated. Thank you.
Screen view of Database Diagram (http://64.122.37.190/images/diagram.jpg)
Screen view of problem view (http://64.122.37.190/images/viewshifts.jpg)
I am working with a Access Data Project and MSDE database server. In the image you can see the tables that I am working with. I have a table, tblShifts, that has all of the shifts with clock in and out times for all buildings. I am trying to downsize this list to include only buildings that the user is matched with in tblManagerBuildings by using SUSER_SNAME() to get there current username. Seems easy enough.
Only I can't get it to work. It does give you only shifts in the buildings that you are assigned to. But when you go to delete or insert wierd things happen. If I have the query set up as it is in the "Screen view of problem view" link I get an error "The field 'shiftnum' is read-only" when I try to insert or delete. So I tried another way. First I set up a view that gives you all of the buildings that you have access to.
View all of the user's buildings (http://64.122.37.190/images/viewMyBuildings.jpg)
Then I connect that to tblShifts and get all shifts in the user's buildings:
Shift table connected to user's buildings (http://64.122.37.190/images/viewShifts2.jpg)
If I output the BuildingNum column when you go to delete a record nothing happens. If I output the username column I get the "The field 'shiftnum' is read only" error. If I don't output any of the columns from viewMyBuildings then when I delete a row it Deletes the Building and the User from ALL of the tables. Including all of the shifts associated with the building. AWWW! I know that this is possible. My problem is probably with having a many - to - many relationship, but I have been working on the for a day and a half and I think I took care of the many to many relationship properly. If anyone has any input PLEASE HELP!
Hi everyone I have a problem that I have deleted some records from a table in my database and now after one week I need these records again. Can someone tell me how to get them?
We have a massive db and on one of the screens the users can scroll through the records and view information they can also add new records. When the users enter the new record and go back to it it has been successfully stored in the relevant table even on exitin the form via the exit button (DoCmd.Close). However from time to time when the user enters the new record and closes the for via the close form button the new entry is not stored in the table and seems to have been deleted or not appended to the table.
We have no idea why this is happening as it doesnt happen all the time just from time to time.
Can anyone help please or has anyone come across this before !
Someone created a form and then deleted it. When we try to use the find button on other forms, it keeps looking for the deleted form. When I look in visual basic, I can still see the removed form listed, but it is not visible on the form page for me to delete. How do I get rid of this residue.
Can someone please help me. I was in the code view of my database and accidentally deleted a few lines of code and now everything i do is coming up with the same error message
Module Not Found
For every form I try to open it does this and even my buttons to close form and to exit system do not work.
Has anybody had this problem before?
Would anybody mind taking a look at it if I sent a zipped version? my email and msn is nicholaseary@hotmail.com
Hi I would like to prevent the first 24 rows in a table from being deleted by the user, after these 24 rows they can be deleted. Is there anyway of protecting them etc without putting them in a separate table?
This is my first post here and I imagine there will be many more as I have only just started out using Access to create a database at work and I am sure that I'm breaking many rules along the way.
Anyway, over the weekend, my boss tried to add some information (to the "Memo" field) in a form that I have created from a table, went to close the form and got a message saying something along the lines of "this record cannot be saved, if you close it, information will be deleted.
Now, in the Memo field, is the text "#Deleted" - when I try to overwrite this and come out of the record, it comes up with the message "record is deleted". If I put information in any other field in the record, there is no problem.
Also, in the table, if I try to sort by the Memo field, it comes up with same message, "record is deleted".
Does anyone know what I've done and how I can solve this?
I have deleted certain content from a table. After it I have compressed and repaired the database but later I found out that I need those deleted data. But now they are gone. Is there any possibility to recover it? Are there any tools or something?
I have a table with a blank record at the begining and populated records thereafter. I used the cmd button wizard to create a delete button for that table. Is there a way to prevent the blank record (record 1) from being deleted by the command button but still allow all other records to be deleted?