Modules & VBA :: Running Query With No Lock
Apr 1, 2014
I am running delete and update queries using docmd.runsql. I am finding that particularly after the update query is ran the record is locked and other field in that record can not be updated via a form without a warning saying another user has made changes to the record. To be more specific -- I have a vendor table which has fields vendorname, vendorstreet, vendorcity, vendoraddress. A form is used to place a street address to the vendorname. onexit of the street textbox an update query is ran using DoCmd.RunSql updateing the vendoraddress field to an 'X'. When I put the city in and then close the form this is when the error occurs stating that another user has made changes to the record. My thought is that the update query has not unlocked the record. The customer wants the X to be placed in the field without his manually placing it in the field.
View Replies
ADVERTISEMENT
Nov 8, 2013
Is there any way to modify the progress bar so instead of saying "running query" it states the name of the query?
Like: Running Query [qryFRED] <progress bar>
View 1 Replies
View Related
Jan 16, 2014
I have vba code that creates the following SQL:
SELECT SubscheduleID, EventID, WeekOrder, DayID, StartTime, EndTime, Priority, CanJoin, PatientTitle, PatientNickname, IncludesPatient, IncludesAftercare, Letter1
FROM [qryScheduleCombinedDetails]
WHERE (SubscheduleID = 1 AND IncludesPatient = -1 AND DuringAftercare <> "AC only" AND (WeekOrder = "All" OR WeekOrder = 3 OR (WeekOrder = 1 AND Letter1 = "XYZ")) AND DayID = 2 AND StartTime <= #8:00:00 AM# AND EndTime >= #8:30:00 AM#);
When I try to run it, I get a "data type mismatch" error. When I put the same code into a query, I get the same error. However, it will run if I delete either condition from within the (WeekOrder = 1 AND Letter1 = "XYZ") pairing. I can't figure why it can run with either of those, but not both together.
WeekOrder is defined as String. Letter1 is calculated as Cstr(Nz(IIf(Letter,"XYZ","ABC"))) within [qryScheduleCombinedDetails], because I wanted to make sure that it would be recognized as a string.
View 4 Replies
View Related
Mar 2, 2015
I have a form in datasheet view and on that form I have a yes/no tick box is it possible that when the tick box is ticked it locks the line from further entry.
View 3 Replies
View Related
Jun 7, 2013
I have a field within a form that needs to be modified based off of someone's access level and I have written that part but not sure how to keep others from modifying the field.
Code:
Private Sub Qty_Rcvd_Click()
If ap_GetUserName() = "Danny_Davis" Or ap_GetUserName() = "christopher_ayers" Or ap_GetUserName() = "Tena_McCrackin" Then
GoTo 10
Else
MsgBox "You are not authorized to view this form"
End If
10
End Sub
Right now this code will bring up the msgbox for someone not authorized but once they hit "ok" the msgbox goes away and they can still change the field. What can I type in here to lock down the field for someone not authorized?
View 3 Replies
View Related
Jan 26, 2015
i want to be able to create an On Click Event when pushing a command button that will run an Update query to update a record and after it has been updated that specific record will pop up on a Form and be displayed. i know a different way is to run the Update query and then have it displayed in a Select query but i want it to be displayed on a Form instead. is it possible?
View 4 Replies
View Related
Jun 13, 2005
I need to lock and unlock a a few text fields with a CMd Button.
and i do know about the allowedits thing, but i only need to apply this to a few fields on my form.
can some one throw me a clue?
View 2 Replies
View Related
Aug 7, 2013
I want to incorporate a button that locks a certain portion of my form but my form is still quite long...
Is there a way which I can lock multiple fields at once or do i have to do:
Code:
Field1.Enabled = False
Field2.Enabled = False
Field3.Enabled = False
Field4.Enabled = False
and so on...
View 4 Replies
View Related
Jun 29, 2015
I'm trying to lock a checkbox when the forms open and depending if one has role as admin, it should unlock it.When I add the below code in the on open form I get error:
Code:
Me.lock_case_admin.Locked = True
Me.lock_case_admin.BackColor = 12632256
This is the part that should onlock if it is admin:
Code:
Me.lock_case_admin.Locked = False
Me.lock_case_admin.BackColor = 16777215
Maybe it is me, or the checkbox is giving the error that causes the dialogbox to open to to choose the ID nr.
View 5 Replies
View Related
Apr 7, 2015
What I'd like to do is have an "export button", where the OnClick event, exports a single table into a new accde file. This would allow the end users to zip this file up and send it to me.
Because of all sorts of stupidity, I have no network capability and must send data back and forth via email.
I have digressed to a replication table that needs to be uploaded, once data is entered by the users...
Because the files can get relatively large (for emailing purposes), I am trying to figure out how I can get just one table from them vs. sending the whole application file back to me... It's pretty vital that they not be able to edit the table because that could really mess up the process.
So any way to create a new lock file from within the current Db?
View 1 Replies
View Related
Aug 4, 2015
I'm trying to lock certain fields on my form based on the value in a particular field. It seems to work the first time but applies itself to all other records in the database from then on!
The starting point is a command button that sends an email and makes Me.DPLLock = 1. The corresponding table entry is formatted as a number.
The code is...
Private Sub Form_Current()
If Me.DPLLock = 1 Then
Me.OR_Name.Locked = True
Me.OR_Sales_Order.Locked = True
Me.OR_WO_No.Locked = True
Me.OR_Qty.Locked = True
[Code] ....
Ive tried Me!DPLLock with the same result.
View 7 Replies
View Related
Feb 18, 2014
I'm trying to open or unlock a recordset do do a simple calclation and then relock the record set. How this can be done with vba?
View 7 Replies
View Related
Oct 31, 2014
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 ?
View 1 Replies
View Related
Oct 25, 2013
I am looking to completely disable a record when a specific Yes/No tick box is checked.
By that I mean all form fields are locked and disabled when the Yes/No tick box is checked (Yes)
View 2 Replies
View Related
Oct 20, 2014
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?)
View 5 Replies
View Related
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'.
View 4 Replies
View Related
Mar 27, 2015
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???
View 2 Replies
View Related
Jan 7, 2013
I have just installed the windows version of Access 2010 on OSX Mountain Lion using a program called Crossover which works very similarly to WINE. I have found that Access will install fine except for VBA form modules and BAS modules, although there seems to be no indication that they did not install as the entire install progresses fine.
I've put together an invoicing program that was created in Access 2010 in Windows but have transferred it over to Access 2010 installed on OSX. It contains a number of forms with code but when I go to VBE, form code modules are not visible. When I try to view the code for a form I get the following error message: "Microsoft Access failed to create the Visual Basic module. If your database is on a network drive, check your network connection, then try again". I was able to insert a BAS module and create a rudimentary VBA subroutine which ran without error so it does seem able to interpret VBA as per normal.
View 2 Replies
View Related
Feb 23, 2015
I'm trying to run an sql update query (in VBA) to update values in a table, from calculated field values in a subform (using a query as a record source).
Is this possible , and if so, can I call the subroutine from the parent form, and what would be the correct syntax for the VBA sql string (i'm guessing it would be a docmd.runSQL sqlstringname )??
View 1 Replies
View Related
Aug 5, 2015
I have determined the solution to my problem lies outside of normal SQL queries and I need to create a UDF.
Here is the problem. I need to create a running total based on the sum of two fields [PTS_ISSUED] & [PTS_REDUCED] with one restriction. The total can never be less than 0. If it is less than zero, the totals reset with [PTS_ISSUED] as the new starting point.
I've attached an excel spreadsheet. Column"C" contains the formula logic I am trying to replicate into access.
I will be honest, writing the UDF is beyond my current knowledge but once I see it I am able to understand it and implement it.
I believe the solution needs to store the running total into a variable, make the necessary comparisons and determine if its okay to add the [PTS_ISSUED and [PTS_REDUCED] to the stored total of the previous calculations then advance. I just have no clue in how to go about writing it.
This calculation needs to be presented in Access because the results will drive several other functions within the database.
View 8 Replies
View Related
Jan 31, 2014
I have 2 forms and a macro in Form1 which runs throught every record to update the records, however.I would like to run this macro from the main form (Form2)
I have tried
docmd.openform "Form1"
Run Macro
but it doesnt work
View 4 Replies
View Related
Jul 23, 2015
I created a database that uses the "lngEmpName " number to give user permissions , what I need is to be able to disable the running of the database (or main form)and show an error message using vba if I have not logged in for around two weeks is this possible ? if so how and even better a demo would be fantastic.
View 4 Replies
View Related
Nov 7, 2014
I have a POS system, packaged with Access Runtime, running on a PC and have developed a database system to provide additional function. I have no documentation to the names of the Forms or Controls in POS. My ADDON system does link to the POS Tables and has some Tables of its own.
At the time in the POS system where the cashier checks out the customer, they need to AltTab to my ADDON system to enter some information for the customer. They remember to CustomerKey from the screen on the POS system and key it into a Form Control in my ADDON system.I want to, from my ADDON system, read the value of the CustomerKey in POS and fill it in so the cashier does not need to remember/type it.
Is it possible to get the data from another already running Access database?I don't know the name of the control. Is it possible to run through a list of Forms and Controls in the POS system from my ADDON system?
I do know the name of the field in the Table and expect it to be current and might have to get that?Failing all that, is there a Collection of running Access databases? I could go through its Forms and Controls one time looking for what i want.
View 1 Replies
View Related
Feb 12, 2007
Afternoon.
I have had a search through the forum however am unable to find anything...
I have two questions:
a) How do I check whether someone else is currently accessing a record / form?
i.e. Opening the form (SchemeDetails) like this:
DoCmd.OpenForm "SchemeDetails", acNormal, "", "", acEdit, acNormal
Forms!SchemeDetails.SetFocus
DoCmd.GoToRecord acForm, "SchemeDetails", acGoTo, tempVal
Can I check if someone else is in the specified record before I open it? Record Locking is (deliberately) set to "No Locks".
b) How do I check to see if a table exists?
i.e. If DataTable2.Exists = True then ...
Or something like this?
Hope someone can help me!
View 6 Replies
View Related
Feb 11, 2014
I have a field that generates a date from when the first input is put into another field.
I know and can lock the "date" field in the form but is it possible to lock that date in the table and query?
View 1 Replies
View Related
Dec 10, 2014
I have a situation where I am using a maketable query to create a table and then I need to use append queries to then add additional records to the created table - some of these are just run once and some multiple times.
if possible, I do not want to hard code the query multiple times i.e.
Code:
DoCmd.OpenQuery "qryCreate_1"
DoCmd.OpenQuery "qryAppend_1"
DoCmd.OpenQuery "qryAppend_1"
DoCmd.OpenQuery "qryAppend_1"
etc
So is there a way I can run the make table query and then get some sort of loop to run the append query a number of times ?
View 4 Replies
View Related