Don't know if this is the right place, trying to format a field based on data. (1 Viewer)

odin1701

Registered User.
Local time
Today, 10:45
Joined
Dec 6, 2006
Messages
526
I don't know a ton of VBA or SQL really but I'm working on just a simple database.

I am making a DB that will store door access logs. It shows the persons name, date and time that they entered as well as any exceptions or denied access, and I want it to show which door. The problem is that each door is just assigned a number - 1, 2, 3, etc. So when I display the LockID in the form for which door it just shows the number. I would like it to say the name of the door, based on which number is there. I.E. when it sees a 1 it should replace that with "Front Door", etc. I just don't know how to format the code to make that work, so some help would be appreciated.
 

ansentry

Access amateur
Local time
Tomorrow, 02:45
Joined
Jun 1, 2003
Messages
995
Here is a sample for you to have a look at.
So when I display the LockID
You should never display this (the Auto Number Primary key) to the user.

You will note that I have used an automnumber for the doors table and also used a number field to give each door a number this could also be text (e.g D1 D2 etc).

Hope this helps.
 

Attachments

  • Doors.zip
    23.2 KB · Views: 340

odin1701

Registered User.
Local time
Today, 10:45
Joined
Dec 6, 2006
Messages
526
Here is a sample for you to have a look at.
You should never display this (the Auto Number Primary key) to the user.

You will note that I have used an automnumber for the doors table and also used a number field to give each door a number this could also be text (e.g D1 D2 etc).

Hope this helps.

I am not displaying the primary key (auto number). The LockID is simply a number that refers to which door the particular record is for. So if someone enters the front door it will note the time, date, user, entry, and then the number 1 for the front door.

Anyway that did help...I was spacing out here after looking at crap all day. Cheers :)
 

Users who are viewing this thread

Top Bottom