Tracking Visits by Members

  • Thread starter John R. Youngman
  • Start date
J

John R. Youngman

Hi. I have a membership database that will now be used to track member
visits to our location. When the member's record is displayed, I'd like to
have a button that I can click on which will add the time and date to their
record each time they visit. I think I need a separate table to store this
info. Any ideas?

TIA

John
 
J

John Vinson

Hi. I have a membership database that will now be used to track member
visits to our location. When the member's record is displayed, I'd like to
have a button that I can click on which will add the time and date to their
record each time they visit. I think I need a separate table to store this
info. Any ideas?

You do indeed need a second table, with fields for the MemberID, and
the date and time of the visit. You can set the Default property of
this field to Now() if you'll be entering the data at the time of the
visit; if you just display the visits table as a Subform of the member
form, you can simply add a new record and it will record the time
automatically.
 
J

John R. Youngman

Thanks for your advise, John.

Is there a way to populate the fields in the second table by using a command
button on the form? If I'm displaying the member record, I'd like to have a
button the the user can click which will add an entry to the second table
for the time and date. The entry will be done at the time of the visit, so
the Now() part should work just fine.

Thanks again.

John
 
J

John Vinson

Is there a way to populate the fields in the second table by using a command
button on the form? If I'm displaying the member record, I'd like to have a
button the the user can click which will add an entry to the second table
for the time and date. The entry will be done at the time of the visit, so
the Now() part should work just fine.

Sure. The button could simply run a one-row Append query:

Private Sub cmdVisit_Click()
Dim strSQL As String
strSQL = "INSERT INTO [Visits] (MemberID, VisitTime) Values (" _
& Me!MemberID & ", #" & Now() & "#")
DoCmd.RunSQL strSQL
End Sub
 

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