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?
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
I am trying create some code that checks if the contents of the status field in a table is "Authorised" where the ID = something specific for multiple records. If all records witht the specific ID are "Authorised" Then generate a new record in another table. Where to start, perhaps a Dlookup?
I have a code that finds the first, second, and third minimum value in a row across the fields. Now, I am trying to find a code to look at these values, find the field it is located, and return the field name. I tried several variations of my code to return the field name rather than the value, but have been unsuccessful to this point.
Function NthMinimum(intPosition As Integer, ParamArray FieldArray() As Variant) As Variant Dim varTempArray() As Variant, varTempValue As Variant, intArrayValues As Integer Dim I As Integer, J As Integer ReDim varTempArray(UBound(FieldArray)) intArrayValues = 0
[Code] ....
As you can see, this works to find these values while ignoring NULLS. How to return the field name?
I am using MS Access 2010 and I am struggling to write some vba in my database. On my form, I have a Payment Type dropdown field.When someone selects a payment type I want the code to calculate the end date. Then populate the End Date field with the answer.I will be having a few payment types too, but for now on the dropdown I have two.2/Month and 24/Annum.
convert the following into VBA code for an Access 2007 field on a form. It is needed to create a conditional default value based on another field's category: (Note: TransType, MembershipYear and Dues are field names and are all on the form). Based on the TransType (which is really a category of membership) I want the Dues field to have the applicable default value automatically entered.
For MembershipYear > 2008 If TransType="Individual" or TransType="I" Dues=35.00 If TransType="Family" or TransType="F" Dues=50.00 If TransType="Founder" Dues=100.00 If TransType="Student" Dues=10.00 If TransType="Lifetime" Dues="" or is Null If (TransType is Null or TransType="") and TotalPaid >0, Dues=35.00
I have created code to import and excel file and create a table from that info. Now I need to confirm that the import has the correct Datatype of Number and Fieldsize of Double for one of the columns.
I am using the function below to calculate a field that excludes weekends and holidays. The weekends are excluded as it is now, but when I try to add in code to exclude holidays I am getting errors. The code for the holidays is in bold and a couple of the errors are Loop without Do so I remove the Loop then I get a Else without If.
Code: Option Compare Database
Public Function WorkingDays(Due_Date As Date, Result_Date As Date) As Integer '-- Return the number of WorkingDays between Due_Date and Result_Date On Error GoTo err_workingDays
hi, i would like to be able to prevent a user from being able to change a field (lock a field) in a main form if a field in a subform is complete. (the field in the subform is named: "new_weekly_base" if this is complete then i would like the field: "weekly base" to be locked on the main form. is this possible?, please help.
the main form is named: "SCREEN-MAIN" the subform is named: "SCREEN-SUBFORM" (the main form has a button on it which loads the subform.)
ive tried the below code but it doesnt work, any help would be excellent.
------------------------------------------------------- Private Sub Form_BeforeUpdate(Cancel As Integer) If [NEW_WEEKLY_BASE] >= 0 Then
With Me.WEEKLY_BASE .Visible = True .Enabled = False End With End If End Sub ------------------------------------------------
I create the datasheet form, I know how to lock the field, but it lock the whole column of the field. I want to lock the field except the last record field only. Can I do that?
eg. ID Field1 Field2 1___a______b 2___c______d 3___z
I've looked through the forum but haven't found quite what I want. I am a novice but realise this is going to be a relatively simple one ....
I use an invoice form for my own business with client details and a sub form with invoice lines. The client is selected via a combo box. I realise the danger that I could inadvertently alter the client, so would like to lock the client field when I move on to the next invoice or close the record, I don't want to lock the invoice lines. Can't get the code quite right and not sure whether this should be AfterUpdate or OnExit?
I'm doing a project for Tafe and I have some yes no questions on my form and a text box next to each one for detials if the answer was no for tick box I want the text box not to be able to write in ...
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.
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.
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:
The question is in the title... How do I allow people to enter data into a field once, but then lock it or disable it from being editted later. Tried this: Private Sub SubmittedD_Enter() If SubmittedD = Null Then SubmittedD.Locked = False Else SubmittedD.Locked = True End If End Sub but the If statement isn't working... it just does the Else statement regardless of wether SubmittedD is null or not.
I'm still using Access 2003 to manage our membership database, is it possible to lock a field(member's name) if the membership is equal to withdrawal or terminated? Possible to use "on click"?
Is it possible to lock a field in a form after the user has populated the field? So for example, I have two date fields and I want them to be locked after the user has entered values on those fields. I want to avoid the user to come back in the future and change those fields. However I would like the database administrator to be able to change those dates when needed. How do I do this?
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?
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 ?