By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,199 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,199 IT Pros & Developers. It's quick & easy.

Form to get data. With a button to save them to a table. Access 2007

P: 2
Hi guys, I'm new to Access & SQL. Currently using Access 2007. What I have:

1) Table: Employee( empID, empName, email, pwd, ... )
2) Form: - Record source ( SELECT empName, email, pwd FROM Employee )
3) 1 combo box. cmbName. Row Source (SELECT Employee.empName FROM Employee;
4) 2 textboxes . txtEmail and txtPwd
5) Button : - Register (no info) and Close form ( Close form button created with button wizard )

Notes:
email field has (Like "*?@?*.?*") validation
Everything is unbound. I guess.I'm not sure with the term though. Sorry

The user is to select his/her name. Type the email and password and click Register. Then the Register button should copy the data to the table and wont allow duplicate email or duplicate password.

I have no idea on how to do it.It is required to use the register button. I found the DAP articles but it's not supported in Access 2007 anymore and I need to perform this on a form.

What coding / setting i need to put on the Register button? Do I need to leave the validation rule in the table or delete that and make the Register button handle the validation. Please help. Sorry if my explanation is not clear. Questions are welcome. Thanks again
Sep 28 '07 #1
Share this Question
Share on Google+
1 Reply


nico5038
Expert 2.5K+
P: 3,072
Hi guys, I'm new to Access & SQL. Currently using Access 2007. What I have:

1) Table: Employee( empID, empName, email, pwd, ... )
2) Form: - Record source ( SELECT empName, email, pwd FROM Employee )
3) 1 combo box. cmbName. Row Source (SELECT Employee.empName FROM Employee;
4) 2 textboxes . txtEmail and txtPwd
5) Button : - Register (no info) and Close form ( Close form button created with button wizard )

Notes:
email field has (Like "*?@?*.?*") validation
Everything is unbound. I guess.I'm not sure with the term though. Sorry

The user is to select his/her name. Type the email and password and click Register. Then the Register button should copy the data to the table and wont allow duplicate email or duplicate password.

I have no idea on how to do it.It is required to use the register button. I found the DAP articles but it's not supported in Access 2007 anymore and I need to perform this on a form.

What coding / setting i need to put on the Register button? Do I need to leave the validation rule in the table or delete that and make the Register button handle the validation. Please help. Sorry if my explanation is not clear. Questions are welcome. Thanks again

In the OnClick event of the combobox you would need this code to check the username to exist:
Expand|Select|Wrap|Line Numbers
  1. IF IsNull(Dlookup("empName","Employee","empName='" & Me.cmbName & "'")) then
  2.    msgbox "Invalid username"
  3.    exit sub
  4. end if
  5.  
The other values can be checked this way too, but for the unique Email address and pwd I would define a unique index on the table, thus preventing them to be entered anyhow.
The duplicate pwd is puzzling me a bit as they should be "secret".

Also the difference between a first time user and one "known" is a bit "odd".
I would expect the emailaddress to be filled for a known user and a double entry of the pwd to make sure it's entered correctly...

Nic;o)
Oct 5 '07 #2

Post your reply

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