Adding data to form

G

Guest

I have a fairly simple question but I cannot get my head around it. I'm
creating a database to keep track of website content. I'm encountering
problems with the new form I'm creating. I'm assuming it's because of my
tables.

The content on every page follows a similar template. There are a total of
17 different content titles. For example, Services Provided, Service
Providers, Information for the Public, Affiliations and Partnerships,
Admission Requirements, Contact Information, etc. Some pages will have
content under every title, others wont. What I wanted to do is have a form
where there is the name of all the titles and there would be a memo text box
beside each title where you could type in the content. When a title does not
apply to a specific page, you would just add N/A. I don't know how to set up
my tables.

Here are all of my tables so far:

Page: PageID (primary key), Page Name, Last Modification Date, Reviewing
Frequency, URL Department, Page Status, Manager, Director, Service Area.

Notes: NotesID (primary key), PageID (foreign key), Notes, NotesDate

SuperUser: SuperUserID (primary key), Page ID (foreign key), First Name,
Last Name, Manager

Content Status: Page ID (foreign key), Content Status

Content Approver: Approver ID (primary key), Page ID (foreign key), First
Name, Last Name.

I have a form based on the Page table with a sub-form for notes based on the
Notes table. I would like to have a button on the Page form which will link
to another form which has all of the content. On this linked form, I would
also like to have sub-forms for Content Status and Content Approver.

Please help!!!
 
G

Guest

It looks to me like there may be an issue with the SuperUser table and the
Page table.

You have a Page ID PK in the Page table, with a FK Page Id in the SuperUser
table. I'm not sure what type of website this is for, but isn't it possible
for a user to be accessing more than page on the website? If so, the way you
have it won't work without having duplicate records of the User in the
SuperUser table. The best approach for a many to many relationship is to add
a table to break the relationship into two one-to-many relationships.

Let me know if you need help....
 
G

Guest

I thought I knew I was doing but obviously not. From what I understand, my
table is ok because a SuperUser (person responsible for the page) can have
more than one page but one page can only have one SuperUser. Therefore, this
is a one-to-many relationship. I removed the page ID from the SuperUser
table. I used the primary key from the SuperUser table as the foreign key is
the page table. However, I can't seem to link these two in a form. I created
the Page form. I also created a SuperUser form. Using the wizard, I placed a
command button in the Page form to open the SuperUser form. However, the two
forms are not corresponding. It's really frustrating.
 
G

Guest

Changing the foreign key reference to SuperUser still isn't going to solve
your problem because a single page can have many users. The way you have it
set up will only allow for one user to be assigned to a pageid, unless you
have duplicate entries in your Page table.

What you need is a bridge table, which is simply another table whose fields
contain the foreign keys of your two M2M tables:

Create a new table( SuperUserId, PageId)
Link SuperUserId from your SuperUserID table, link PageId from your Page
table. Set both fields to be your primary key.

AA
 
G

Guest

I did this. I created a new table Page_SuperUser and added the PageID and
SuperUserID fields and created the relationships. Both are primary keys.

I still have not solved my problem. How do I create a command button from
the parent form Page to open a new form (SuperUser) to view the specific
record relating to each specific page? For example, the user will open the
record for the Home Page to view the SuperUser for that specific page, the
user then proceeds to the next page, About Us, and the SuperUser information
will automatically go to the information for the About Us page.

I hope I'm making sense.
 
G

Guest

It sounds like you are in need of a form that specifically assigns users to
pages. Access has no relating the data from the two tables. You need to
tell it to assign SuperUser Sally to the Home page. Start small, create a
new form and bring in these fields:

Page table:
PageID
PageName

Bridgetable:
PageID
SuperUserID

SuperUser:
SuperUserId
LastName

Access will ask how you want to group it by, group it by bridge. Mostly
likely when you open the form, you will have no records because so far, you
have not been populating the bridge table. Enter a record, just adding the
Last Name & PageName. (I'm assuming that your primary keys are autonumber).
Click next record and then go back to the one you just created. Notice how
Access automatically filled in the page id & superuserid fields
automatically.

You can btw delete the foreign key textboxes on the form. I just had you
insert them so it would build your sql query behind the form. You can get
rid of the primary key fields to since those are autonumber. Some designers
just hide them so they aren't enabled and the user can see when a new record
is being created.

HTH!
AA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top