473,399 Members | 4,177 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,399 software developers and data experts.

Message box that will ask you to provide user information if you click save

2
I'm using this code to either ask for user information if not provided OR save the user info if available BUT when i click on my command button save, i get this message when no info is provided,"New User has been successfully added"

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSave_Click()
  2. If UserId = "" Or Password = "" Or UserName = "" Or AuthorityLevel = "" Then
  3.  
  4.     MsgBox "Complete User Information NOT Provided"
  5.     Else
  6.  
  7. DoCmd.Save
  8. DoCmd.GoToRecord , , acNewRec
  9.  MsgBox "New User has been successfully added"
  10. End If
  11. End sub
Oct 3 '12 #1
4 1689
Rabbit
12,516 Expert Mod 8TB
Are you sure the default values are blank strings? Or are they nulls? Usually if no data has ever been entered, the value of the field will be null, not a blank string as you have it.
Oct 3 '12 #2
Jodeny
2
The default values are null.
Oct 3 '12 #3
zmbd
5,501 Expert Mod 4TB
Then per Rabbit, you need to test for Null values as the double quote is not the same.
Oct 3 '12 #4
TheSmileyCoder
2,322 Expert Mod 2GB
Assuming you have a textbox on your form by the name of tb_Username, there are 2 ways to test it for :
Expand|Select|Wrap|Line Numbers
  1. If Me.tb_UserName & ""="" then
works since Null & "" is equal to ""
Another way is:
Expand|Select|Wrap|Line Numbers
  1. IF Nz(Me.tb_UserName,"")="" then
The NZ function is used to convert a null value to a safe value, or a default value if you wish.
Oct 3 '12 #5

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

Similar topics

1
by: Haffi | last post by:
hi, I have a proplem creating a new user and/or adding additional information for root user in MySQL Administrator 1.0.19. When I do I get this message: error while storing the user information....
2
by: Tamir Khason | last post by:
I build user control, consists of different things (e.g label, image, etc.) I want to handle click (and other) events, however I can not do it until I do not assign event handler for each control...
0
by: Federica | last post by:
Hi! I need some help retrieving user information in Active Directory. I have one webform with 2 textboxes 1 username and one for password. When the user load this page and insert his username and...
3
by: Vadym Stetsyak | last post by:
Hi there! Is it possible to retieve user nt name from the web request? This question arose while thinking about authentication system implementation in the asp.net. I want to make...
5
by: Patrick F | last post by:
I got a link to my .aspx page, when the link is pressed i want the user to be able to download what the .aspx sends to it. Inside my .aspx page i have a string called strPage, i want that strPage...
7
by: msc | last post by:
Hi guys, How to get the user information like userid written in C language.
7
by: korund | last post by:
I want solve a small problem. Since javascript can't read and write as a file, VBScript is used in a code. When a user click's on a 'Yes' button on a Internet Explorer activeX prompt, a VBScript...
4
by: Benny Ng | last post by:
Dear All, <input type="checkbox" name="chkAgreement" value="0">I agree with the above terms and conditions <asp:ImageButton ID="ImgBtnSubmit" Runat="server" CausesValidation=True...
5
by: ThunderMusic | last post by:
Hi, I'd need to find (or develop) a control of a map (worldwide if possible) where a user can click and drag to select an area by distance from the click point or using a square area (user's...
20
by: sam12 | last post by:
I have an application where all the fields on the form are locked preventing editing of the information(Through a function lockUnklockfrm) until an edit button on the form is clicked or NEW RECORD...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.