Create New Field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to be able to add a new field to an existing table, but can't figure
out how to do it w/ VBA.

Existing table is named tblWhatsNew.
A new boolean Yes/No field needs to be added to tblWhatsNew whenever a new
record is added to a table named tblAgents.
The new field needs to be named with new value of the FirstName in the
tblAgents table.

Thanks in advance for pointing me in the right direction!

....By the way, for a little background: I will have a form that pops up at
login that will list new features or announcements, and the user will check a
box indicating they have read the announcement, so in the future when that
same user logs in they will only see the announcements they haven't read.
Hence, I need to keep track of each user's read/not read information and this
seems like the simplest way.
 
Doing it that way, while possible, would be breaking normalisation rules.
You'd be better off doing it this way...

Your users table can stay exactly as it is. (...which I'm assuming you have
and assuming it has a PK field)

Create a many to many relationship from users to tblAgents by creating a new
table... tblWhatsNew2 (or whatever). This would just need to have two
fields - UserID and tblAgentsID - these would be foreign keys for the two
PKs on users and tblAgents.

When the user checks the box, append a record to that table containing the
ID of the user and ID of the agent. That records that they've read it.

Your list of unread announcements will just be a subtract query to list IDs
in agents that don't have a corresponding record in tblAgents2 linked to the
current UserID.
 
Back
Top