View Full Version : Your help in Default Value?Please


faiz
01-30-2008, 07:58 AM
Dear Sir...:)

Please your help it is urgent for me.

There is to table:
First table name (UserName) with fields:
1- UserID
2- name

Second table (Website) with fields:
1- Id
2- UserID
3- WebSiteURL
And there is one-to-many relationship between them.

what I have to do if any new users register by default; it gives him URL (I have to let default more than one).:confused:

Please your help ASAP.
Regards;
FAIZ

faiz
01-31-2008, 12:23 AM
Please you help

faiz
02-01-2008, 12:54 AM
please please your help:(:o:confused:

Fernando
02-01-2008, 04:20 AM
You mean: If a new user registers then create a website record?

faiz
02-01-2008, 07:52 AM
yeas it is .

please your help

Fernando
02-01-2008, 10:13 AM
The only way i can think of is using forms with vba code
Do you know how to make forms and use vba code with them?

Moniker
02-01-2008, 10:22 AM
In the table design for Website, enter the default value of "www.yourdomain.com". Now each time a new userID is entered, the field WebsiteURL will automatically be populated with "www.yourdomain.com" (without the quotes).

faiz
02-01-2008, 06:41 PM
Mr.Moniker

What if I have to give 2 or 3 default value?
Note: I’ll use the database for website.

Please your reply

FAIZ

Moniker
02-01-2008, 11:19 PM
Explain a little more. The way I'm reading it, if it's user type A, then they get default Domain A. If it's user type B, then they get Domain B. And so on.

Am I right on that?

faiz
02-02-2008, 02:21 AM
No!
If user A and B they register they will get the same default websites Example: yahoo.com, msn.com, .access-programmers.co.uk.

Regards,

Moniker
02-02-2008, 11:00 PM
You're making no sense here. How are you differentiating? How you you saying "This user gets this default" and "This other user gets this other default"?

I'm not following.

faiz
02-03-2008, 12:51 AM
Please see attach, and open username table try to add any username, you’ll find the default value for WebSiteURL(Moniker) ,what I have to do, to make more than WebSiteURL name as default .

I hope it is clear now.

Moniker
02-03-2008, 11:03 AM
Don't do that at the table level. If I get a few minutes, I'll show you how to do this through a form. The user should never be able to touch the tables. You've also not attached the UserID fields to each other, meaning the UserID in the table "UserName" and the UserID in the table "Website" are independent, unrelated, and therefore pretty useless as keys.

Think on that for a bit. You've got the right idea but the wrong implementation. Again, if I get a moment, I'll write up a quick sample DB and show you how to do it. But in the mean time, see if you can do it on your own.

Moniker
02-04-2008, 11:30 AM
Here's a sample for you. A few things to look at:

1) Look in the relations from the DB window. You'll see that I'm enforcing referential integrity, which ensures that the two tables stay in sync.

2) The form (f_Main) is based on a query. This query takes the two tables and pulls the appropriate information from each (all of t_Users, only URL from t_Website). Changes in this form will automatically be reflected in both tables.

3) The "Add New User" button simply makes sure that the name fields are not blank. Then it forces a move to a new record, which automatically saves the current record.

4) You cannot get duplicates because the URL is created like this: FName_LName_UserID.com. Since UserID is a unique value, two "John Smith" entries will not create duplicates.

Open the form (f_Main) and you can enter names and see how this all works. Use the record selectors at the bottom of the form to cycle through the records and see that the changes/additions are made.

This should show you how to do what you want. Just make sure you understand the structure. Note that the primary table (t_Users) has a primary key on an AutoNumber so that it automatically generates, while the primary key in t_Website, also called UserID, is a Long Integer (same as an AutoNumber) because we want it synced with the AutoNumber, not a newly generated number.

HTH

faiz
02-05-2008, 08:01 PM
Regards

Thank you and estimator your help and your effort with me.

Unfortunately for me this is not what I want, my dear?

I was talking with my friend about what I need, he spayed i have to make default website in third table, and I have to make auto macro if any user he register the auto macro it will copy all website from third table to related user.

Please see attach,


Regards,