Update table with button

  • Thread starter Thread starter meghanwh
  • Start date Start date
M

meghanwh

I have a query "New People Query" which is based on a few tables. Then
I have a form "Alumni Form" which is based on the query. The form
pulls up alumni records, so their ID number is on the form and each
person has a record on the new People Query. I would like to be able
to click a button and have it enter today's date and the alum's ID in
a separate table "DeanMeet Tbl" which is linked by ID. The button is
for each time I meet with someone, so I can click the button and it
records that i met with them today. I might meet with people multiple
times, which is why it is stored in the separate table. Is there a way
to do this? Thank you.
 
I have a query "New People Query" which is based on a few tables. Then
I have a form "Alumni Form" which is based on the query. The form
pulls up alumni records, so their ID number is on the form and each
person has a record on the new People Query. I would like to be able
to click a button and have it enter today's date and the alum's ID in
a separate table "DeanMeet Tbl" which is linked by ID. The button is
for each time I meet with someone, so I can click the button and it
records that i met with them today. I might meet with people multiple
times, which is why it is stored in the separate table. Is there a way
to do this? Thank you.

In the Click event of the button, add code something like this:

DoCmd.RunSQL "INSERT INTO [DeanMeet Tbl] ([MeetDate],[ID]) VALUES (#" & Date
& "#," & Me.ID & ")"

Use your own field and control names.

Carl Rapson
 
I have a query "New People Query" which is based on a few tables. Then
I have a form "Alumni Form" which is based on the query. The form
pulls up alumni records, so their ID number is on the form and each
person has a record on the new People Query. I would like to be able
to click a button and have it enter today's date and the alum's ID in
a separate table "DeanMeet Tbl" which is linked by ID. The button is
for each time I meet with someone, so I can click the button and it
records that i met with them today. I might meet with people multiple
times, which is why it is stored in the separate table. Is there a way
to do this? Thank you.

In the Click event of the button, add code something like this:

DoCmd.RunSQL "INSERT INTO [DeanMeet Tbl] ([MeetDate],[ID]) VALUES (#" & Date
& "#," & Me.ID & ")"

Use your own field and control names.

Carl Rapson

I did that, and it appends the rows with the date, but it isn't
putting the ID number in. When I click the button, it asks for the
parameter value with the ID number in the dialog box (where normally
it would say something like "Enter Year" or whatnot). The code I have
is:

DoCmd.RunSQL "INSERT INTO [DeanMeet Tbl] ([DeanMeetDate],[UID]) VALUES
(#" & Date & " #," & Me.UID & ")"

Thanks.
 
I have a query "New People Query" which is based on a few tables. Then
I have a form "Alumni Form" which is based on the query. The form
pulls up alumni records, so their ID number is on the form and each
person has a record on the new People Query. I would like to be able
to click a button and have it enter today's date and the alum's ID in
a separate table "DeanMeet Tbl" which is linked by ID. The button is
for each time I meet with someone, so I can click the button and it
records that i met with them today. I might meet with people multiple
times, which is why it is stored in the separate table. Is there a way
to do this? Thank you.

In the Click event of the button, add code something like this:

DoCmd.RunSQL "INSERT INTO [DeanMeet Tbl] ([MeetDate],[ID]) VALUES (#" &
Date
& "#," & Me.ID & ")"

Use your own field and control names.

Carl Rapson

I did that, and it appends the rows with the date, but it isn't
putting the ID number in. When I click the button, it asks for the
parameter value with the ID number in the dialog box (where normally
it would say something like "Enter Year" or whatnot). The code I have
is:

DoCmd.RunSQL "INSERT INTO [DeanMeet Tbl] ([DeanMeetDate],[UID]) VALUES
(#" & Date & " #," & Me.UID & ")"

Thanks.

On your form, what is the name of the control that is bound to the UID
field? That's the name you need to use in the RunSQL statement.

Carl Rapson
 
I have a query "New People Query" which is based on a few tables. Then
I have a form "Alumni Form" which is based on the query. The form
pulls up alumni records, so their ID number is on the form and each
person has a record on the new People Query. I would like to be able
to click a button and have it enter today's date and the alum's ID in
a separate table "DeanMeet Tbl" which is linked by ID. The button is
for each time I meet with someone, so I can click the button and it
records that i met with them today. I might meet with people multiple
times, which is why it is stored in the separate table. Is there a way
to do this? Thank you.
In the Click event of the button, add code something like this:
DoCmd.RunSQL "INSERT INTO [DeanMeet Tbl] ([MeetDate],[ID]) VALUES (#" &
Date
& "#," & Me.ID & ")"
Use your own field and control names.
Carl Rapson
I did that, and it appends the rows with the date, but it isn't
putting the ID number in. When I click the button, it asks for the
parameter value with the ID number in the dialog box (where normally
it would say something like "Enter Year" or whatnot). The code I have
is:
DoCmd.RunSQL "INSERT INTO [DeanMeet Tbl] ([DeanMeetDate],[UID]) VALUES
(#" & Date & " #," & Me.UID & ")"

On your form, what is the name of the control that is bound to the UID
field? That's the name you need to use in the RunSQL statement.

Carl Rapson- Hide quoted text -

- Show quoted text -

The control on all the tables and forms is called UID, which is what
is in there. It still gets the same problem, asks for a parameter
value of the UID.
 
On May 23, 6:35 pm, "Carl Rapson" <[email protected]>
wrote:

I have a query "New People Query" which is based on a few tables. Then
I have a form "Alumni Form" which is based on the query. The form
pulls up alumni records, so their ID number is on the form and each
person has a record on the new People Query. I would like to be able
to click a button and have it enter today's date and the alum's ID in
a separate table "DeanMeet Tbl" which is linked by ID. The button is
for each time I meet with someone, so I can click the button and it
records that i met with them today. I might meet with people multiple
times, which is why it is stored in the separate table. Is there a way
to do this? Thank you.
In the Click event of the button, add code something like this:
DoCmd.RunSQL "INSERT INTO [DeanMeet Tbl] ([MeetDate],[ID]) VALUES (#" &
Date
& "#," & Me.ID & ")"
Use your own field and control names.
Carl Rapson
I did that, and it appends the rows with the date, but it isn't
putting the ID number in. When I click the button, it asks for the
parameter value with the ID number in the dialog box (where normally
it would say something like "Enter Year" or whatnot). The code I have
is:
DoCmd.RunSQL "INSERT INTO [DeanMeet Tbl] ([DeanMeetDate],[UID]) VALUES
(#" & Date & " #," & Me.UID & ")"
Thanks.
On your form, what is the name of the control that is bound to the UID
field? That's the name you need to use in the RunSQL statement.
Carl Rapson- Hide quoted text -
- Show quoted text -

The control on all the tables and forms is called UID, which is what
is in there. It still gets the same problem, asks for a parameter
value of the UID.- Hide quoted text -

- Show quoted text -

Nevermind, I figured it out. What I didn't tell you was that the ID
field was text, so it needed another quote. Thanks!
 
Back
Top