473,398 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How to set AllowAddition properties in form

hi guys I am new in access. And i have problem like..
I have login form with two users and another form Laptops
and i want to set AllowAddtion property "yes" for one user and "no" for other user. How can i do that.

Here is my login form code

Expand|Select|Wrap|Line Numbers
  1. If Me.txtPassword.Value = DLookup("password", "tblUsers", "[UserName]='" & Me.txtUserName.Value & "'") Then
  2.     If Me.txtUserName = "admin" Then
  3.  
  4.     isValid = True
  5.     myRibbon.InvalidateControl "tabAdmin"
  6.     End If
  7.  
  8.     If Me.txtUserName = "guest" Then
  9.     isValid = True
  10.  
  11.     End If
  12.  
  13.     DoCmd.Close acForm, "LoginForm", acSaveNo
  14.     DoCmd.OpenForm "Welcome"
  15.  
  16. Else
  17.  
  18. MsgBox "Password Invalid. Please try again", vbOKOnly, "Invalid Entry!"
  19. Me.txtPassword.SetFocus
  20. End If
May 31 '11 #1
3 2528
NeoPa
32,556 Expert Mod 16PB
Welcome to Bytes!

DoCmd.OpenForm() has a parameter (OpenArgs) to allow passing of information to the newly-opened form. Use this to pass a string to indicate to the form whether it should be True or False.

In the Form_Open() procedure look at this value and set the .AllowAdditions property depending on what you find there.
May 31 '11 #2
hi Neopan,
Thanks For reply but actually i am started access before just 1 month so i don,t know actually how to use that so can please write code for me.

Thanks,
Hardik Patel
Jun 1 '11 #3
NeoPa
32,556 Expert Mod 16PB
We don't write code for people Hardik. We don't even allow people to ask for that (check the rules of the site). What I will do though is post some example code that will help you to write your own code.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2.     Dim strAllowAdds As String
  3.  
  4.     strAllowAdds = Nz(Me.OpenArgs, "")
  5.     Me.AllowAdditions = (UCase(strAllowAdds) = "YES")
  6. End Sub
Your code may use other names but the concept would be fundamentally the same.
Jun 2 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Nancy | last post by:
Hi, I am working on a project where I have to make a form list static, i.e. put in links so that users can choose a local file. As it stands, it's looking for a php file. Here's an example of the...
8
by: deko | last post by:
I'm trying to find a way to set form/control properties programmatically. In a nut shell: 1. Open a database 2. Open a form in design view 3. Do something like this: For Each prp In...
8
by: deko | last post by:
I'm hoping someone can sanity check my understanding of the Object Model for Forms/Controls. I'm having trouble drilling down into Control properties. First, I have a record set with the...
19
by: Raposa Velha | last post by:
Hello to all! Does any of you want to comment the approach I implement for instantiating a form? A description and an example follow. Cheers, RV jmclopesAThotmail.com replace the AT with the...
6
by: BUX | last post by:
If I try to read MyControl.text I receive Run-Time error 2185 that means about < Impossible to refer to a property or a metod if the control is not active >. But this happen only if the form...
1
by: dk | last post by:
Any idea why the response time is slow when running a system tray app when viewing the properties form? There is one primary loop and a timer control which executes every 3minutes. Is having the...
3
by: Mateusz Rajca | last post by:
Hello, I have Form1 - the main form with some controls including a button. I have Form2 - the properties form with a combobox and button. The user can select the colors of a button in the...
6
by: jean.ulrich | last post by:
Hi I have a form that is not related with a table neither a query (unbound form) On this form I have a text field where the user can put a text or a number As I dont want to create a table...
7
by: Rene | last post by:
We all know that we can't call custom methods or properties form generic type parameters (<T>) by default because the compiler will complain about his. For example, the following won't normally...
1
by: CDrue | last post by:
Hello, Is it possible to create inside MDIForms additional child forms which also have form children? For my application it is necessary to create a hierarchy of forms, e.g. MainMDIForm...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.