I am planning to give different rights (AllowEdit, ViewOnly…) to the user on accessing forms and reports in a db on a single pc instead of dealing with server as my client have only one pc.
As a present requirement, db would be in one pc only and would be used by 3-4 users. I need each of users to limit their access to some of the forms and reports in the same pc. To get it, what I did is as follows:
Example:
One of my tables called tblEmployees (Back End Table) linked in FE containing following fields:
There is a login menu form. Something like 2 text boxes on the form and opening at the startup. User selects his name from a combo and types his password. If the user is available in the tblEmployees, Access opens main form and store UNumber and UName with time stamp in a local table called “T_CurrUser. If user not available in tblEmployees, it should close or give some msg.
Now, when the Main form opens (after login with correct user and pwd) and user wants to click different command buttons to open the form, I need to write code to check whether the current user have right to open the selected form (check marked to allow opening this form in the table tblEmployees) BEFORE opening it.
If check mark is set to false on F1 in the table tblEmployees, it means he can’t open form1, and a msg should pop up “Not allowed to view”..Something likes that.
1. I don’t know the code I created with simple if then, where to write ? I mean on which event of form ? On open / On Activate or where. Bcz the code should run before form opens and should check the table whether the user have check mark value true or false.
I tried to write the following code but some time it works some time doesn’t. What is wrong with code lines?
On Click of Command Button that opens Form1
Dim USR = DlookUp(“lngEmpId”,”T_CurrUser”) ‘ Local Table emp.
‘To check if Form1 check mark is set to true If DlookUp(“F1”,”tblEmployees”,”lngEmpId=USR)=True Then Docmd.OpenForm “Form1” Else End If
When another user logs on the same pc (off course, after login out of first user) the local table T_CurrUser record will be replaced with new user. Note that local table T_CurrUser contains always one record. Hopefully I described correctly.
I have a form based on a table (master) with a cbo which returns yes or no according to what users select.
I then have another form which get's its data from a query based on the above table (master). This time, the value I have selected in the previous form using the cbo, should be displayed using a check box.
This is how I would like it to work:
If Me.cbo = yes (meaning that the value selected is yes), then
check box should show be checked.
If Me.cbo indicated NO, then, the check box should not be checked.
I'm trying to get a field in my Data Access Page to display the last time a field was updated, I figured I would have to do this in HTML, after a lot of dead ends elsewhere. Here is the code:
<SCRIPT language=vbscript event=BeforeUpdate(dscEventInfo) for=MSODSC> <!-- Dim DateModified DateModified = Date 'Current System Date dscEventInfo.DataPage.Recordset.Fields("DateModified") = Date
--> </SCRIPT>
Any clues where I would enter this in the HTML source?
Here is my problem. I have several fields located on a form. The user has a problem finding the curser on what field its on. I did ok with the text fields, but I need to come up with something for the check boxes. Any Ideas
The code below works good for text fields. But I need to do the same for Check Boxes or the Check Box Label that is associated with the check Box.
Private Sub Ctl4bCode_Enter() Me.Ctl4bCode.BackColor = RGB(255, 0, 0)
End Sub
Private Sub Ctl4bCode_Exit(Cancel As Integer) Me.Ctl4bCode.BackColor = RGB(255, 255, 255)
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.
Enforce referential Integrity and Cascade Update Related Fields
Thus, it is possible to change the name of the state or city, but can not be deleted until the state is associated with some of the city.
I also made a form for the "state" in which is the list that contains a list of all states. The name of the list is "lstState". So that I can delete the "State" I make a button in form and I use the following code:
Code: Private Sub DeleteState_Click () If IsNull (Me.lstState) Then MsgBox "Select the state you want to delete", vbCritical else DoCmd.SetWarnings False
[Code] ....
Everything works fine when the state is not assigned to any one city. But the problem arises when trying to delete a state which is assigned to the city, that is when I select this state and click on the delete button then the state is not deleted - this is ok, but without any message told why the state is not deleted and that's the problem.
My question is how to make the code that the user receives a message that such State can not be deleted because there are cities that are associated with it.
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 bound form with a few fields. I would like to run a sub after some of these fields are modified, but not others. I would like it to run only once, after user finishes his work on the form.
When using the Unload event - the form on the form is not there anymore (or did I get something wrong?).
Is there a way to trap Data on form just before the form closes?
Hi, sorry but i have a new issue. Ok, here it goes.
I have a check box on my form that "black lists" that related record. I wish to warn the user that when they click/after update the check box, they will no longer be able to work with this contact unless an administrator unblocks the record.
Here is the VBA for what i have done so far.
Private Sub orgMisc_AfterUpdate() Dim intAnswer As Integer intAnswer = MsgBox("Are you sure you wish to Black List this contact?" _ , vbQuestion + vbYesNo, "Time Saver") If intAnswer = vbYes Then orgMisc = True Else orgMisc = False End If End Sub
This works fine except for 1 problem. It prompts me if i change my mind and uncheck the check box. So basically, if (default) is False Then OnClick i want the above VBA to execute. If the check box already isset to TRUE then ignore the above VBA and orgMisc (checkbox) change to FALSE.
If any 1 can offer advice or knows how to solve this issue, that would be great :)
Hi I need code to open TeacherDetailFrm form Main form.
I have TeacherStudentSubFr*m on the Mainform, FirstNameTxt on the TeacherStudentSubFr*m, and TeacherDetailFrm. I need code to open the TeacherDetailFrm By double click on the FirstNameTxt.
I use this code but no data come and query dialog box come.
Private Sub FirstNameTxt_DblCli*ck(Cancel As Integer) Dim DocSubForm As String Dim DocText As String DocSubForm = "TeacherDetailFrm" 'DocText = "[Result]=" & "'" & Me![result] & "'" DoCmd.OpenForm DocSubForm, , , "[ FirstNameFld ]=forms![TeacherStudentSubFrm]![ FirstNameTxt]"
End Sub
I like to upload the file but no way in this forum
I have a form that has unbound check boxes on it. They are linked to a query. The query has the following script in the criteria section
[Forms]![frmTEST]![Check0]
This is set up so that when I put a check in the checkbox and press the control button it envokes the query. I have 6 boxes on the form with the same script for the exception of the [Check0] number.
Right now the way it is set up I have to check the exact sequence in order to get any data. Is there a way that I can simply check a box and pull up all the records that are checked. (Ex. I check "Box 1" and push the control button. I want it then to show me all the records that have a check in "Box 1" regardless of what the other check boxes are.) So far I have not found a way to do this.
Hi I have a form that displays the results from a query. I have a check box that users select in order to show they want to print that record However, it has stopped letting me change the check box, and simply gives me the helpful windows 'bing' when I click on it. All the controls are set to allow me to write to it. Has anyone got any ideas of why this might happen? Cheers Ben salt P.S. If I go into the table directly, I can still change the status of the check box
OK....I have done a search but am still none the wiser regards allowing for VAT (added to an old thread but no luck!).
I am designing a little DB for an accountant at work. He wants to be able to keep tabs on orders he places with various vendors (currently uses excel) but he needs to generate reports etc. I have done this but would like to afford him the ability to add VAT to the order total if required.
So here is what I want to do. I want to add a check box to an Order Form that will add VAT at the current rate. If the VAT rate changes at some point in the future I do not want historic data updated to the new rate.
I want to add it to the Order Form as not all companies being invoiced are VAT registered. This will give the user the option to add VAT or not.
I have had a little play (see attached) but do not know how to get it all working!
Help, advice appreciated (or if anybody has a working example of VAT?). Cheers, Phil.
I am new to access, and no nothing of programming, so please keep any answers simple!!
I have a form which the user then inputs data, I need to check that the data does not exist in a table. I was trying to do this with a validation rule, but can't get anything to work.
I have a form that users type in a part number and a due date. I then run a report that prints the part number, the components needed and the processes needed. For example:
------User Form-------
Part 1 6/25/05 Part 2 6/28/05 Part 3 7/1/05
---------Report--------
Part 1 6/25/05
Component 1--------SAW-----WELD------SMOOTH Component 2--------WELD-----PAINT ------------------------------------------------------------- Part 2 6/28/05
Component 1--------DRILL-------WELD Component 2--------SMOOTH-----PAINT ------------------------------------------------------------- Part 3 7/1/05
I'm confused about how to go about this. I don't want the users to have to manually type in anything. I want the components and processes to show up when they type in the part number. I want the user to be able to check off processes as they go, but I want all the processes to show up when they type a new part in the form. I would appreciate it if someone would point me in the right direction.
I have a form with a series of check boxes (see image below). The check box is always in the top left had corner and is very small. Does any one know if it is possible to:
a. Have the check box in the centre b. Enlarge the check box, so the tick itself appears larger
I have a form in wich I can add and edit employees. I can open this "employee" form in 2 ways: 1. From another form 2. From the mainmenu
When I close the "employee" form I want to check if the otherform (1.) is open. If it is open I want to requery the other form. If it is closed I don't want to requery the other form. How can I check if the other form is open?
I hope that you guys can help me and thanks in advance, Johnny
We use 2 different forms for employees based on status. Pending, and active. Staff members should not be able to be set to active unless all the fields on the Pending form are completed. Is there anyway I can check to make sure the form is completely filled in before allowing a status change to Active?
I have a continous form that contains text boxes, combo boxes and a check box. Upon clicking the check box, I have added code to disable the text and combo boxes on the corresponding row. However, when I click the check box, all rows are disabled (which is want I don't want).
Is there any way to only have the row, where the check box is checked, to be disable, and none of the other rows (where the check box is not checked)?
Hi all first post but im hoping someone can help. Im tryng to make a form with 3 check boxes on it and a results text box and a command button, that when dependent on if the check box was ticked then after the command buuton is presses this will display the result in the text box?
Im pretty much new to all this any help would be amazing thanks!