Updating values on query based form | | |
Hi, in the past I've spent ages writing VB routines to get around this
problem, is there a simple way?
I have three tables for a membership system:
tblMembership - MembershipNumber; Names etc
tblMembershipSubsHeader - "AmountDue" [their annual subs rate]; whether
the pay by standing order and so on
tblMembershipSubs - PaymentYear [auto created for current year];
DatePaid; AmountPaid
I list all of these on a form, the record source is a query linking all
tables [the relationship is already set up]
BUT I cannot update the records in the form, I need to update DatePaid
and AmountPaid.
The only condition set in the underlying query is for the PaymentYear
[DatePart("yyyy",Date())]
I could write some VBA to update these two fields via sql, however I'm
aware that this will not be visible on the form until it is refreshed,
the problem then is that if I do this via code it will go to the
top..... I'd then need to use more to go back to the current record....
!!! Very messy - is there an alternative??
Thank you in anticipation
Jon | | | | re: Updating values on query based form
you can remove tblMembershipSubs from the query that underlies the form. add
a subform to the form, and bind the subform to tblMembershipSubs; you can
update the subform records via direct data entry.
hth
"J-P-W" <jonpwebb@gmail.comwrote in message
news:1169307506.985073.108110@38g2000cwa.googlegro ups.com... Quote:
Hi, in the past I've spent ages writing VB routines to get around this
problem, is there a simple way?
>
I have three tables for a membership system:
>
tblMembership - MembershipNumber; Names etc
tblMembershipSubsHeader - "AmountDue" [their annual subs rate]; whether
the pay by standing order and so on
tblMembershipSubs - PaymentYear [auto created for current year];
DatePaid; AmountPaid
>
I list all of these on a form, the record source is a query linking all
tables [the relationship is already set up]
>
BUT I cannot update the records in the form, I need to update DatePaid
and AmountPaid.
>
The only condition set in the underlying query is for the PaymentYear
[DatePart("yyyy",Date())]
>
I could write some VBA to update these two fields via sql, however I'm
aware that this will not be visible on the form until it is refreshed,
the problem then is that if I do this via code it will go to the
top..... I'd then need to use more to go back to the current record....
!!! Very messy - is there an alternative??
>
Thank you in anticipation
>
Jon
>
| | | | re: Updating values on query based form
Thanks Tina, Unfortunately I have the form as continuous - so no sub
forms! Continous is best so the entire membership can be looked through
quickl... any other thoughts?
Thanks
Jon
tina wrote: Quote:
you can remove tblMembershipSubs from the query that underlies the form. add
a subform to the form, and bind the subform to tblMembershipSubs; you can
update the subform records via direct data entry.
>
hth
>
>
"J-P-W" <jonpwebb@gmail.comwrote in message
news:1169307506.985073.108110@38g2000cwa.googlegro ups.com... Quote:
Hi, in the past I've spent ages writing VB routines to get around this
problem, is there a simple way?
I have three tables for a membership system:
tblMembership - MembershipNumber; Names etc
tblMembershipSubsHeader - "AmountDue" [their annual subs rate]; whether
the pay by standing order and so on
tblMembershipSubs - PaymentYear [auto created for current year];
DatePaid; AmountPaid
I list all of these on a form, the record source is a query linking all
tables [the relationship is already set up]
BUT I cannot update the records in the form, I need to update DatePaid
and AmountPaid.
The only condition set in the underlying query is for the PaymentYear
[DatePart("yyyy",Date())]
I could write some VBA to update these two fields via sql, however I'm
aware that this will not be visible on the form until it is refreshed,
the problem then is that if I do this via code it will go to the
top..... I'd then need to use more to go back to the current record....
!!! Very messy - is there an alternative??
Thank you in anticipation
Jon
| | | | re: Updating values on query based form
what are the specific table relationships?
"J-P-W" <jonpwebb@gmail.comwrote in message
news:1169323302.396348.26320@11g2000cwr.googlegrou ps.com... Quote:
Thanks Tina, Unfortunately I have the form as continuous - so no sub
forms! Continous is best so the entire membership can be looked through
quickl... any other thoughts?
>
Thanks
>
Jon
>
tina wrote: Quote:
you can remove tblMembershipSubs from the query that underlies the form.
add Quote: Quote:
a subform to the form, and bind the subform to tblMembershipSubs; you
can Quote: Quote:
update the subform records via direct data entry.
hth
"J-P-W" <jonpwebb@gmail.comwrote in message
news:1169307506.985073.108110@38g2000cwa.googlegro ups.com... Quote:
Hi, in the past I've spent ages writing VB routines to get around this
problem, is there a simple way?
>
I have three tables for a membership system:
>
tblMembership - MembershipNumber; Names etc
tblMembershipSubsHeader - "AmountDue" [their annual subs rate];
whether Quote: Quote: Quote:
the pay by standing order and so on
tblMembershipSubs - PaymentYear [auto created for current year];
DatePaid; AmountPaid
>
I list all of these on a form, the record source is a query linking
all Quote: Quote: Quote:
tables [the relationship is already set up]
>
BUT I cannot update the records in the form, I need to update DatePaid
and AmountPaid.
>
The only condition set in the underlying query is for the PaymentYear
[DatePart("yyyy",Date())]
>
I could write some VBA to update these two fields via sql, however I'm
aware that this will not be visible on the form until it is refreshed,
the problem then is that if I do this via code it will go to the
top..... I'd then need to use more to go back to the current
record.... Quote: Quote: Quote:
!!! Very messy - is there an alternative??
>
Thank you in anticipation
>
Jon
>
>
| | | | re: Updating values on query based form
This is the whole query:
SELECT tblMemberSubs.Year, tblMembers.MemberNumber, tblMembers.Surname,
tblMembers.Forenames, tblMemberSubsHeader.TotalDue,
tblMemberSubsHeader.StandingOrder, tblMemberSubs.DatePaid,
tblMemberSubs.Amount
FROM tblMemberSubsHeader INNER JOIN (tblMemberSubs INNER JOIN
tblMembers ON tblMemberSubs.MemberNumber = tblMembers.MemberNumber) ON
tblMemberSubsHeader.MemberNumber = tblMembers.MemberNumber
WHERE (((tblMemberSubs.Year)=DatePart("yyyy",Date())))
ORDER BY tblMembers.MemberNumber;
Thanks
Jon
J-P-W wrote: Quote:
Thanks Tina, Unfortunately I have the form as continuous - so no sub
forms! Continous is best so the entire membership can be looked through
quickl... any other thoughts?
>
Thanks
>
Jon
>
tina wrote: Quote:
you can remove tblMembershipSubs from the query that underlies the form. add
a subform to the form, and bind the subform to tblMembershipSubs; you can
update the subform records via direct data entry.
hth
"J-P-W" <jonpwebb@gmail.comwrote in message
news:1169307506.985073.108110@38g2000cwa.googlegro ups.com... Quote:
Hi, in the past I've spent ages writing VB routines to get around this
problem, is there a simple way?
>
I have three tables for a membership system:
>
tblMembership - MembershipNumber; Names etc
tblMembershipSubsHeader - "AmountDue" [their annual subs rate]; whether
the pay by standing order and so on
tblMembershipSubs - PaymentYear [auto created for current year];
DatePaid; AmountPaid
>
I list all of these on a form, the record source is a query linking all
tables [the relationship is already set up]
>
BUT I cannot update the records in the form, I need to update DatePaid
and AmountPaid.
>
The only condition set in the underlying query is for the PaymentYear
[DatePart("yyyy",Date())]
>
I could write some VBA to update these two fields via sql, however I'm
aware that this will not be visible on the form until it is refreshed,
the problem then is that if I do this via code it will go to the
top..... I'd then need to use more to go back to the current record....
!!! Very messy - is there an alternative??
>
Thank you in anticipation
>
Jon
>
| | | | re: Updating values on query based form
okay, well, that didn't answer the relationships question. so i'll assume
that tblMembers has a one-to-one relationship with tblMemberSubsHeader, and
tblMembers has a one-to-many relationship with tblMemberSubs.
if the above is correct, try changing the JOINs in your SQL statement, as
SELECT SELECT tblMemberSubs.Year, tblMembers.MemberNumber,
tblMembers.Surname,
tblMembers.Forenames, tblMemberSubsHeader.TotalDue,
tblMemberSubsHeader.StandingOrder, tblMemberSubs.DatePaid,
tblMemberSubs.Amount
FROM (tblMemberSubsHeader LEFT JOIN tblMembers ON
tblMemberSubsHeader.MemberNumber = tblMembers.MemberNumber) LEFT JOIN
tblMemberSubs ON tblMembers.MemberNumber = tblMemberSubs.MemberNumber
WHERE tblMemberSubs.Year=Year(Date())
ORDER BY tblMembers.MemberNumber;
note that if tblMembers has a one-to-many relationship with *both* child
tables, the above query is still not updateable. also, Year is a reserved
word in Access; recommend you change the fieldname from Year to something
else, like PmtYear.
hth
"J-P-W" <jonpwebb@gmail.comwrote in message
news:1169325100.862658.66190@l53g2000cwa.googlegro ups.com... Quote:
This is the whole query:
>
SELECT tblMemberSubs.Year, tblMembers.MemberNumber, tblMembers.Surname,
tblMembers.Forenames, tblMemberSubsHeader.TotalDue,
tblMemberSubsHeader.StandingOrder, tblMemberSubs.DatePaid,
tblMemberSubs.Amount
FROM tblMemberSubsHeader INNER JOIN (tblMemberSubs INNER JOIN
tblMembers ON tblMemberSubs.MemberNumber = tblMembers.MemberNumber) ON
tblMemberSubsHeader.MemberNumber = tblMembers.MemberNumber
WHERE (((tblMemberSubs.Year)=DatePart("yyyy",Date())))
ORDER BY tblMembers.MemberNumber;
>
Thanks
>
Jon
>
J-P-W wrote: Quote:
Thanks Tina, Unfortunately I have the form as continuous - so no sub
forms! Continous is best so the entire membership can be looked through
quickl... any other thoughts?
Thanks
Jon
tina wrote: Quote:
you can remove tblMembershipSubs from the query that underlies the
form. add Quote: Quote: Quote:
a subform to the form, and bind the subform to tblMembershipSubs; you
can Quote: Quote: Quote:
update the subform records via direct data entry.
>
hth
>
>
"J-P-W" <jonpwebb@gmail.comwrote in message
news:1169307506.985073.108110@38g2000cwa.googlegro ups.com...
Hi, in the past I've spent ages writing VB routines to get around
this Quote: Quote: Quote:
problem, is there a simple way?
I have three tables for a membership system:
tblMembership - MembershipNumber; Names etc
tblMembershipSubsHeader - "AmountDue" [their annual subs rate];
whether Quote: Quote: Quote:
the pay by standing order and so on
tblMembershipSubs - PaymentYear [auto created for current year];
DatePaid; AmountPaid
I list all of these on a form, the record source is a query linking
all Quote: Quote: Quote:
tables [the relationship is already set up]
BUT I cannot update the records in the form, I need to update
DatePaid Quote: Quote: Quote:
and AmountPaid.
The only condition set in the underlying query is for the
PaymentYear Quote: Quote: Quote:
[DatePart("yyyy",Date())]
I could write some VBA to update these two fields via sql, however
I'm Quote: Quote: Quote:
aware that this will not be visible on the form until it is
refreshed, Quote: Quote: Quote:
the problem then is that if I do this via code it will go to the
top..... I'd then need to use more to go back to the current
record.... Quote: Quote: Quote:
!!! Very messy - is there an alternative??
Thank you in anticipation
Jon
>
| | | | re: Updating values on query based form
Sorry I didn't specify the relationships, but yes you got that right.
Thank you for your help if the records remains not updateable then I
guess I'll need to write that code after all!!
Regards
Jon
tina wrote: Quote:
okay, well, that didn't answer the relationships question. so i'll assume
that tblMembers has a one-to-one relationship with tblMemberSubsHeader, and
tblMembers has a one-to-many relationship with tblMemberSubs.
>
if the above is correct, try changing the JOINs in your SQL statement, as
>
SELECT SELECT tblMemberSubs.Year, tblMembers.MemberNumber,
tblMembers.Surname,
tblMembers.Forenames, tblMemberSubsHeader.TotalDue,
tblMemberSubsHeader.StandingOrder, tblMemberSubs.DatePaid,
tblMemberSubs.Amount
FROM (tblMemberSubsHeader LEFT JOIN tblMembers ON
tblMemberSubsHeader.MemberNumber = tblMembers.MemberNumber) LEFT JOIN
tblMemberSubs ON tblMembers.MemberNumber = tblMemberSubs.MemberNumber
WHERE tblMemberSubs.Year=Year(Date())
ORDER BY tblMembers.MemberNumber;
>
note that if tblMembers has a one-to-many relationship with *both* child
tables, the above query is still not updateable. also, Year is a reserved
word in Access; recommend you change the fieldname from Year to something
else, like PmtYear.
>
hth
>
>
"J-P-W" <jonpwebb@gmail.comwrote in message
news:1169325100.862658.66190@l53g2000cwa.googlegro ups.com... Quote:
This is the whole query:
SELECT tblMemberSubs.Year, tblMembers.MemberNumber, tblMembers.Surname,
tblMembers.Forenames, tblMemberSubsHeader.TotalDue,
tblMemberSubsHeader.StandingOrder, tblMemberSubs.DatePaid,
tblMemberSubs.Amount
FROM tblMemberSubsHeader INNER JOIN (tblMemberSubs INNER JOIN
tblMembers ON tblMemberSubs.MemberNumber = tblMembers.MemberNumber) ON
tblMemberSubsHeader.MemberNumber = tblMembers.MemberNumber
WHERE (((tblMemberSubs.Year)=DatePart("yyyy",Date())))
ORDER BY tblMembers.MemberNumber;
Thanks
Jon
J-P-W wrote: Quote:
Thanks Tina, Unfortunately I have the form as continuous - so no sub
forms! Continous is best so the entire membership can be looked through
quickl... any other thoughts?
>
Thanks
>
Jon
>
tina wrote:
you can remove tblMembershipSubs from the query that underlies the
form. add Quote: Quote:
a subform to the form, and bind the subform to tblMembershipSubs; you
can Quote: Quote:
update the subform records via direct data entry.
hth
"J-P-W" <jonpwebb@gmail.comwrote in message
news:1169307506.985073.108110@38g2000cwa.googlegro ups.com...
Hi, in the past I've spent ages writing VB routines to get around
this Quote: Quote:
problem, is there a simple way?
>
I have three tables for a membership system:
>
tblMembership - MembershipNumber; Names etc
tblMembershipSubsHeader - "AmountDue" [their annual subs rate];
whether Quote: Quote:
the pay by standing order and so on
tblMembershipSubs - PaymentYear [auto created for current year];
DatePaid; AmountPaid
>
I list all of these on a form, the record source is a query linking
all Quote: Quote:
tables [the relationship is already set up]
>
BUT I cannot update the records in the form, I need to update
DatePaid Quote: Quote:
and AmountPaid.
>
The only condition set in the underlying query is for the
PaymentYear Quote: Quote:
[DatePart("yyyy",Date())]
>
I could write some VBA to update these two fields via sql, however
I'm Quote: Quote:
aware that this will not be visible on the form until it is
refreshed, Quote: Quote:
the problem then is that if I do this via code it will go to the
top..... I'd then need to use more to go back to the current
record.... Quote: Quote:
!!! Very messy - is there an alternative??
>
Thank you in anticipation
>
Jon
>
| | | | re: Updating values on query based form
you're welcome, and good luck with it. :)
"J-P-W" <jonpwebb@gmail.comwrote in message
news:1169410756.751169.263870@v45g2000cwv.googlegr oups.com... Quote:
Sorry I didn't specify the relationships, but yes you got that right.
>
Thank you for your help if the records remains not updateable then I
guess I'll need to write that code after all!!
>
Regards
>
Jon
>
>
>
tina wrote: Quote:
okay, well, that didn't answer the relationships question. so i'll
assume Quote: Quote:
that tblMembers has a one-to-one relationship with tblMemberSubsHeader,
and Quote: Quote:
tblMembers has a one-to-many relationship with tblMemberSubs.
if the above is correct, try changing the JOINs in your SQL statement,
as Quote: Quote:
SELECT SELECT tblMemberSubs.Year, tblMembers.MemberNumber,
tblMembers.Surname,
tblMembers.Forenames, tblMemberSubsHeader.TotalDue,
tblMemberSubsHeader.StandingOrder, tblMemberSubs.DatePaid,
tblMemberSubs.Amount
FROM (tblMemberSubsHeader LEFT JOIN tblMembers ON
tblMemberSubsHeader.MemberNumber = tblMembers.MemberNumber) LEFT JOIN
tblMemberSubs ON tblMembers.MemberNumber = tblMemberSubs.MemberNumber
WHERE tblMemberSubs.Year=Year(Date())
ORDER BY tblMembers.MemberNumber;
note that if tblMembers has a one-to-many relationship with *both* child
tables, the above query is still not updateable. also, Year is a
reserved Quote: Quote:
word in Access; recommend you change the fieldname from Year to
something Quote: Quote:
else, like PmtYear.
hth
"J-P-W" <jonpwebb@gmail.comwrote in message
news:1169325100.862658.66190@l53g2000cwa.googlegro ups.com... Quote:
This is the whole query:
>
SELECT tblMemberSubs.Year, tblMembers.MemberNumber,
tblMembers.Surname, Quote: Quote: Quote:
tblMembers.Forenames, tblMemberSubsHeader.TotalDue,
tblMemberSubsHeader.StandingOrder, tblMemberSubs.DatePaid,
tblMemberSubs.Amount
FROM tblMemberSubsHeader INNER JOIN (tblMemberSubs INNER JOIN
tblMembers ON tblMemberSubs.MemberNumber = tblMembers.MemberNumber) ON
tblMemberSubsHeader.MemberNumber = tblMembers.MemberNumber
WHERE (((tblMemberSubs.Year)=DatePart("yyyy",Date())))
ORDER BY tblMembers.MemberNumber;
>
Thanks
>
Jon
>
J-P-W wrote:
Thanks Tina, Unfortunately I have the form as continuous - so no sub
forms! Continous is best so the entire membership can be looked
through Quote: Quote: Quote:
quickl... any other thoughts?
Thanks
Jon
tina wrote:
you can remove tblMembershipSubs from the query that underlies the
form. add Quote:
a subform to the form, and bind the subform to tblMembershipSubs;
you Quote: Quote:
can Quote:
update the subform records via direct data entry.
>
hth
>
>
"J-P-W" <jonpwebb@gmail.comwrote in message
news:1169307506.985073.108110@38g2000cwa.googlegro ups.com...
Hi, in the past I've spent ages writing VB routines to get
around Quote: Quote:
this Quote:
problem, is there a simple way?
I have three tables for a membership system:
tblMembership - MembershipNumber; Names etc
tblMembershipSubsHeader - "AmountDue" [their annual subs rate];
whether Quote:
the pay by standing order and so on
tblMembershipSubs - PaymentYear [auto created for current year];
DatePaid; AmountPaid
I list all of these on a form, the record source is a query
linking Quote: Quote:
all Quote:
tables [the relationship is already set up]
BUT I cannot update the records in the form, I need to update
DatePaid Quote:
and AmountPaid.
The only condition set in the underlying query is for the
PaymentYear Quote:
[DatePart("yyyy",Date())]
I could write some VBA to update these two fields via sql,
however Quote: Quote:
I'm Quote:
aware that this will not be visible on the form until it is
refreshed, Quote:
the problem then is that if I do this via code it will go to the
top..... I'd then need to use more to go back to the current
record.... Quote:
!!! Very messy - is there an alternative??
Thank you in anticipation
Jon
>
>
|  | Similar Microsoft Access / VBA bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,392 network members.
|