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 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?
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 would want my form to calculate the age of a contact by using the inputted birthday, is this possible? and as long as the system clock is right, it should update too? or i'm wrong?
On a form, I want to disable the save button, 'cmdSave' whilst the form's mandatory fields have been left blank.
I've put in a smart tag, called, 'Req' against each required field and have used the following code on the forms current event.
Code: Private Sub Form_Current() Dim ctl As Control For Each ctl In Me.Controls If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Or ctl.ControlType = acListBox Then
[Code] ....
The save button is disabled, but it won't enable again after each field has data entered against it.
I also have this code in the AfterUpdate event in each required field:
Code: Private Sub cboErrorID_AfterUpdate() Call Form_Current End Sub
I am trying to filter a report based on two user inputted dates, but can't seem to figure it out. I've played around with quotation marks, and # but can't seem to figure the syntax out.
Code: Me.OrderBy = "Date Submitted" Me.OrderByOn = True Dim Date1 As Date Dim Date2 As Date Date1 = UserInput Date2 = UserInput DoCmd.ApplyFilter WhereCondition:="[Date Submitted] > Date1 and < Date2"
I have a form called PAF_Assignment and on this form there are many textboxes for editing. After all fields are entered, the user clicks on a button and this button populates the PAF_Issued_Date field with the actual date.
Then I want to disable (enable=False) all fields on this form once there is a date on PAF_Issued_Date as I don't want any user to make any changes after submitting it, although the user would still be able to read the information submitted.
I have tried the following...
PAF_Assignment Form AfterUpdate Event If Me.PAF_Issued_Date=Not null Then Me.FieldName1.Enabled=False Me.FieldName2.Enabled=False Me.FieldName3.Enabled=False
[Code] ......
However this is not working, there is no error message or anything but the fields remain enabled with the date...
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:
I have a form where I select either "Male" or "Female" via tick box. If male is selected I would like it to automatically enter "he" in my table in another field so I can use this info in a Word template letter.
I'm having some trouble getting my information that I input on my form to store in my correct table. I will attach my DB so you can take a look at what I have thus far.
Here is what I am wanting to do:
I have TblEmployee, TblEquipment and TblJunction and FrmTracking and FrmUpdate
I input the bulk of my information thru FrmTracking, my trouble is I can not seem to get the information that I input in my FrmTracking to store in the correct table. I can get the information to store in TblEmployee, however the information that I want to be stored in TblEquipment will not store in there.
I created a query with one expression field that updates a user inputted date field on a form. The expression adds a certain amount of time to the field (usually six months) so I know when the next inspection should take place. Everything works great except when I put a parameter in the expression field. It will not return the property dates. If I simply remove the expression, and input the date manually, it works just fine. Am I not allowed to use date parameter with an expression? It returns every date within the correct month, but will give me future years as well.
The expression is - NextInspectionDate: DateAdd("m",12/[InspectionFrequency],[LastInspectionDate])
The parameter is - Between [Forms]![Preventative Maintenance Dates]![Sta
I have written code to look up a value in a table that then enables or disables a subform in my main form. The code works, but I know it is now as efficient as it can be. The main problem is that I have multiple values that determine if the subform should be enabled or disabled. I would like to use an IN statement but I'm pretty sure this doesn't work for Dlookup. Below is an example of the code I currently have:
Code: Sub enablecontrols(setting As Boolean) Inv_subform.Enabled = setting End Sub Private Sub Form_Current()
[Code] ....
Like I said, this works fine, but I am concerned if I need to add more items to look up and the stability of the code in general.
Access 2007-10 Listbox created: List62 (I know I need to rename it, but for now) Multi-select: Extended Row Source Type: Field List Row Source: qryFieldList Open Query: qrySelectedFields (I added primary key to first column, just to have at least one destination field).
Goal: to select multiple fields within listbox, click on command button to open query "qrySelectedFields" with selected fields from list box.This is the code I have on the command_click:
Dim varItem As Variant Dim strSQL As String If Me.List62.ItemsSelected.Count = 0 Then MsgBox "Please select one or more fields.", vbExclamation, "Healthcare REIT" Me.List62.SetFocus End If
[code]....
It does absolutely nothing - doesn't add the fields to "qrySelectedFields", doesn't open the query, notta.
I am looking to add multiple lines of record to a sub-form via a module activated from another linked sub-form. As an example of what I want to do: On identifying a particular type of vehicle servicing (e.g. 6000 mile service, 12000 mile service) on a service event sub-form of a vehicle form, I want to enter a list of required parts (e.g. oil filter, oil, etc) on another sub-form called "parts", that I can then edit before recording in an underlying table. Can anyone help. Thanks Steve :confused:
I have a terrible skill in this but I am doing my best to find ways. But I am running out of time in the development stage. I have the following form and table:
Tables: Eqpt EqptHistory
Forms: frmEqpt frmHistory
frmEqpt is the Mother form and frmHistory is the subform connected thru eqptID. Now what I want to do is count the records in the frmHistory and Locked the fields for editing. If it is new records, the fields will automatically unlock.
How do I do that because I can't find a way to count the fields with records and lock them.
I have several forms in my database that have a closed (1=Closed) option button. Is there a way to make all of the fields for that record readonly if the closed option is set to equal 1?
i have being requested to create a from that displays the number of files in different folders. I can accomplish this somewhat with the code below. In the example below it is only showing the code for the first 3 folders. I have 7 folders in total to count.
1.Each week the location of the data will change. In the example below it is showing 2014-W03, the following week it will be 2014-W04 etc. etc. I was thinking of having an input box in the form that the user type the date into, to trigger the code, but how would I go about changing the code to include this variable?
2.I need to repeat this code for 9 other products, so my form will be displaying data for 10 products in total. I know I could copy this code 9 times and modify it accordingly, but is it possible to loop it in some way?
Code: ' Returns the total number of fails Private Sub Form_Load() Dim file As Object Dim fileCount As Long With CreateObject("Scripting.FileSystemObject").getfolder(" estmachineProduct1 FAILS2014-W03") For Each file In .Files
quick question... i have a form with a "Save" button. i wanna disable/grey all the fields when user push the button, so they will not be able to make change... please help.
I'm working with a form someone else created and am adding a delete button. I've managed to add the button and get some code working which will delete a record from a table. The problem I'm having is that after the delete operation occurs all fields in the form, and the corresponding items below the form, show #Deleted in all fields. How can I force a refresh using code?
So I have a form which is showing the current record and you can scroll through these and make modifications to them from the form as opposed to using a table.
The form has the following fields populated from the main table
Customer name (Can appear more than once) Status Date Servers Positions
In addition it has several buttons for next record, previous record, first & last record, new record, delete record and update record.On this form i have a text box that i want to be able to use to search for a record using the customer name when you press the search button associated with it. I've got some code and it is mostly working but it seems to be moving the text entry cursor to the date box of the record for some reason.
What I want it to do is take the text from the search box and find it and move the form to that record.
Code: Private Sub btn_cstmr_srch_DblClick(Cancel As Integer) On Error GoTo HandleError Dim strFindWhat As String strFindWhat = Me.txt_cust_search.Value