Modules & VBA :: How To Lock A Table - Stop User Adding Or Altering Records
Sep 19, 2013
I have a form that allows a user to complete a stock take. I would like to stop other users from receiving or despatching stock while a stock take is in progress.
Is there a way I can lock a table, or stop users adding or altering records that match certain criteria. i.e. don't let users receive or despatch stock from with a locationID of 'A'.
I'm trying to run a saved import through VBA, add a new column called "Effective_Date", then update this field for all records to the effective date indicated by the user.
It currently works for all records except 1 is always omitted.
Code: Private Sub cmd_upload_staffing_report_Click() DoCmd.RunSavedImportExport ("Import-AccessUploadStaffingReport") Dim strField As String Dim curDatabase As Object Dim tblTempEmployees As Object Dim fldEffectiveDate As Object
Good morning! I'm building a database for use by four technicians in a call-center type operation. The call records are purely transactional in nature -- once the call has been logged, the record is closed. If the customer calls again, a new record is opened.
The supervisor doesn't want the techs to be able to go back and edit a record once it's entered -- the records are for quality-control purposes and he doesn't want them gaming the system by going back and changing things after the initial call is logged (let's not discuss the issue of employee psychology, motivation, Office Space, etc.). So I'm trying to figure out how to do that; they all have wheel mice, and I can currently see all the records as I scroll back and forward with my mouse wheel, so I'm assuming they'll be able to, as well.
I have a form and I want show a message on the form when the it is locked as another user is editing the data in a particular record.
I know the record selectors show the records lock status but it a very tiny symbol which will mean nothing to the users of the database and anyway I don't want record selector bar on the form. How I would do this???
I have a database containing a mixture of upper and lower case input. I can make upper case appear on the screen by using > in the format box in the property section for each field. This works great but the same old uncorrected stuff remains on the database. How can I get the database to store the corrected upper case data after I have entered it in lower case?
I have a form with sub-forms. All the subforms work smoothly, I am able to assign students to classes, enter their late/absence data etc... But there's 1 subform that I want to include the Gender (male,female) so I have to go back to the query (see attached picture) to include the table with gender data and map it with other tables, then insert a combo box in that subform, which display the gender of the student along side with other data.
But the problem is as soon as I modify the query for that subform, all the subforms (including that one) stop working, I'm not able to enter and change anything with error like Recordset is Noteditable ( see attached screenshot).
And after I remove that table from the query and the combo box from the subform every works just fine again.
I am working with a database that deals with trailers. What is happening is a salesman takes an order for a make and model for a trailer for a customer. The customer can then add some customization to the trailer such as more tail lights or tie down straps. They add the customization on a form called frmCustomQuote. On frmCustomQuote there is a subform called sfQuoteConfigs. On sfQuoteConfigs there is fields such as category and sub catergory that get populated bases on what was selected.
On frmCustomQuote there is a button called "Copy Quote" this will allow the salesman to make an exact copy of the trailer and customization. The quotes are held in a table called tblQuotes and the customization is held in tbQuoteConfigs. Now my problem is when I click on Copy Quote it only copies the first record into tbQuoteConfigs. I can't figure out a way to tell my code to move to the next record within sfQuoteConfigs.
My code:
Code: Option Compare Database Option Explicit 'Setup ADODB connection to the tblQuotes Dim adoQuotesCustomQuote As New ADODB.Recordset 'setup ADODB connection to the tbQuoteConfigs Dim adoQuoteConfigsCustom As New ADODB.Recordset 'Dim the Variables
I have a form that the users enter data into and send a report each day. I would like that in a click of a button all the data I entered the day before and that have ="Open" will be entered into the tables with today's date. Is that possible?
I'm using an append query that needs to add the records from another database into a table. I can get it to get the data and add the records. There are other columns in the database that are not in the one the data is pulled from. If I would run the append query again, it would add the same records again at the end. How can I avoid this? I only need to add new records that are not yet in the database I want to pull the records to.
I have a sales sytem in Access 2010.New customers have to be imported to MYOB daily. I have a query that finds new customers and appends them to a table for importing at a later stage. I export the records in that table if the field "imported" is set to false. The results are exported to Excel so they can be imported into MYOB after some additional data is added. If there are no records to append to the import table I want to stop the export from happening. I am new to VBA and don't know how to express that the select query "000 Append New Customers...." should only run if the append query has records. If there are no records found, I want to put a message saying "no records found". Here is the code I have behind the command button:
Private Sub PrepCustcmd_Click() 'Turn warnings off DoCmd.SetWarnings False DoCmd.OpenQuery "000 Append New Customers to MYOB Customers", acViewNormal, acEdit
I have a question, I'm building a MS ACCESS database and within it i have a table for putting in my program critical parameters. I don't want anyone to change the content of that table. That means not editing the 1 record in it and not adding a new record. Within the program is't a problem but if you make an other blanc database you can import the table, change it and export it back into the program (i know it is far looking but it happens).
How can i lock a table so it cannot change or it cannot be exported or imported???
I have two tables. The first contains details of a budget holders money allocation for a given period, and the other tracks their spend on products over that period. How can I generate a query to calculate the total running spend for each user from the "budget spend table" that will be written into the users record in the "budget allocation table".
My aim is to show details of budget allocation, total spend to date and remaining budget for each user in an Order form / report.
Can anyone please advise me on how to do this or suggest another way of doing it. Any help would be greatly appreciated.
Hello, I use a database at work that I made. Unfortunatly, I did not add a field for numbering the items that a customer orders. When entering an order It is important to my customers to keep it in a certain order. how do I change it so it adds a numbering to all the past orders as well? I've been trying to think of a way for months and cannot do this on my own. Thank you to anyone who takes the time to help me out. If you have any questions I'll try to answer them the best I can.
In a Access 2003 database, I have an "Inscriptions" (subscription) database with a primary key on 2 fields idPersonnel (employee) and idSession. I have made a form so that user can select a session (in a listbox), then one or more employee (another listbox) and suscribe them to that session by using a button, which, on VBA side, first check that there is enough room on the session (defined by "MaxParticipants" field on "Sessions" table, linked to "Inscriptions" table on idSession), then insert data in "Inscriptions" table
This is working fine in a single-user environnement, but fails if 2 people want to join some employees on the same session at the same time, as I have a confirmation message between check and insertion. Therefore 2 users can select employees, get the confirmation message (at this point both are told there is enough room), resulting in having more people than expected joined to the session. Fortuneatly, if both users try to insert the same employee(s) to that table, one will get a duplicate error, but insertion will be made if employees are different.
On another DB engine, such as SQL server, I would use a stored procedure that would lock the table, do the check and the insertion then unlock the table.
But it does not seem to be possible in MS Access. What are the possibilities in MS Access to prevent a session from having more than maximum number of participants ?
I am trying to add a user stamp in a table. I have seen online that perople put a macro (Before Change) in microsoft access 2010 but I dont understand how to use that.
I have seen you are suppose to do something with = Environ("username")
I have a DB with multiple import processes to take in information and populate various tables. This has been in place for some time and works with no issue.
The import process involves the creation of a local staging table, to which I import the received data, normalise it according to my own table structure, remove any duplication (i.e. same data imported repeatedly) and append the cleansed data to the main tables.
I've just added a validation step to check for data integrity. In other words, for duplicate data, rather than simply purge it as I was doing previously, I now check to see if the data has changed in any way and prompt the user if necessary (with the option to either ignore the change or update the existing record)
However, since I added this extra step, I am getting the following error message during my import process :
Error 3211 : The database engine could not lock table 'tblStaging' because it is already in use by another person or process
It only appears a) when a data change is detected and b) when the option to update is chosen, and seems to occur after the update has taken place (i.e. I can see the records suitably updated)
But I can't replicate the error while debugging so it seems to be a run-time issue. It's definitely not another user as the staging table is deliberately local (specific to that user's front-end)
I suspect I can probably solve the problem by adding some kind of DoEvents call or brief pause somewhere but the problem is, I don't know where the problem is occuring, so I don't know where to add the line? Or if that would even solve the problem at all?
Is there an easy function I can call to check if the staging table is locked? Which I could then use to debug and identify exactly where the lock is causing a problem? Or even apply the DoEvents to release the lock? (It must eventually get released as if I step through the code, I don't get the error?)
Is there a way to stop users from opening the front end file twice (stop from having two sessions of the same FE at the same time)?
I've been searching the forum and found this http://www.access-programmers.co.uk/forums/archive/index.php/t-67724.html but since im not using an .exe updater is not my case t.t
Is there anyway to stop the user from beng able to move a form. I.e. as in change its position on screen.
I am aware that you can do this by setting the border type to "none". However, I want my form to have a title bar along the top, so I cant use this method.
Is there another way to do this?
Thanks in advance.
EDIT: Ive found some information on the "movable" property, but I am using access 2000 and cant get it to work.
I am running a access db within a company with about 40 users. I have split the db for multiple users. The only way I have found to fix this problem is to ask the user to close it and reopen it but this is just a quick fix.
Is this cause by our Microsoft servers or is it cause by access. Any help would be great :D
Here is the complet error msg
Could not update; currently locked by user "Admin" on machine 'XXXXXX'
please note that the user is not logged on as "Admin" but as normally user without admin rights.
We have an old computer that is going to be used as a simple signin and out book for volunteers. We want to restrict people on that computer from doing anything else
I have designed the form, and it is nice and evil in that it doesn't allow you to close it (cancel = true in the forms unload event) or even quit access without killing the process manually with the old ctrl-alt-del (or ctrl-shift-esc) it starts on startup and I have disabled the windows key (using XP so I had to add a binary value to the registry manually)
The problem is they can still alt-tab out of there (despite a NoWinKeys registry key that was supposed to stop that), and they can still change the main access window's size and access the start menu.
The network and local profile is such that they can't do a whole lot if they do get past the form, but there should be a way to stop them from leaving... some sort of API that will regain the focus, then I could just check that the application had the focus every second, and pretty much render the computer un-usable
I have a database that is saved as an accdr so it can be compiled for distribution as an exe..I have just found the accdr the exe installed and renamed to accrb and was then able to open it and view all the tables, forms etc.Obviously I cant stop someone renaming but if there was a way to stop the forms, tables etc opening.
How to keep Access from including the detail line items in my report total?
Below is a quick image of part of the report.
The report is compiled from two tables. The first table has detail information on each line, in four columns:
State Name Amount Quantity (Not used)
AL Store 1 313.94 60 AL Store 2 12.59 1 AZ Store 3 576.45 90 CO Store 4 172.22 24 CO Store 5 502.25 88
The 2nd table is a summary by state with three columns:
State Amount Quantity (Not used) AL 326.53 61 AZ 576.45 90 CO 674.47 112
I'm trying to make the report group by state, then name, amount and a subtotal for each state. This all works fine in the report.
I want to also add the amount field from the 2nd table (State Subtotals) to the report just for reference. I've managed to make this work as well. (See State Total on image)
The problem that I'm having is that when I try to do a final total of the State Total column in the report footer, it seems to add the (State Subtotals) amount field on every detail line (See red numbers in picture. they are not actually on the report, but Access thinks they are and includes them in the final total).
So far I've tried different joins, hiding various fields, sub reports, ect. I just can't figure out how to stop Access from calculating the detail lines.
I have a form in which user will enter few values but I need users to enter the comment in relevant text box too only if they have any non zero value.
I have attached an example for reference....where red encircled portion is for values and blue is for relevant comments. If value is non zero then user should be enforced to enter the comment too......system should not allow user to move forward or backward until there is some comment.