Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Subform problem

6 views
Skip to first unread message

nybase...@gmail.com

unread,
Jan 19, 2008, 10:03:10 AM1/19/08
to
This is a repost of an original message posted January 18th. I think
the issue died with those that were looking at it, so I am posting
hoping for some help.

I have a form where I put bills in for a company and break them down
into some detail. There are bills for cellphones, electricity,
heating oil, and cable. I have a main form "BillsNew" that has
fields
that I choose the payee from a combo box. After I make the choice, a
vlookup runs and pulls from another table the type of bill and some
other various details. I have code that runs to open a subform based
on the information in one of the vlookup fields. This code runs on
the
Form's OnCurrent and the field's (Payee) AfterUpdate. The form's
source is the main table "BillsMain".


Now for the subform. The subform's source is a query "subBillsAll".
It opens one of 4 subforms based on the vlookup field "Type", which
is
oil, cable, etc. After the subform opens, the code applies a filter
to pull the record I am viewing in the main form into the fields on
the subform. The strings in the code are in the payee field and a
AutoNumber field. I will place the code below.


The problem is - it seems to be pulling the correct informtion, but
if
I tab through all the information on the form, it moves to the next
record. I want to prevent this, as I have done with other forms by
changing the AllowAdds to No. However, this is not working on this
subform.


Note: I have everything setup this way because there are many fields
that do not apply to all records, so this is the cleanest way. I
plan
to use the subforms in about 4 different forms, so that is why I have
them open to all records and then apply a filter.


Please let me know if any of this is unclear. Here is the code, and
thank you very much for bearing with me.


If IsNull(Me.[Payee]) Then
Me.SubBillsChild.SourceObject = "subBillsMain"
Else
Select Case Me.Type
Case "Electricity"
Me.SubBillsChild.SourceObject = "subBillsElectricity"
DoCmd.ApplyFilter "subBillsNew", ""
Case "Oil"
Me.SubBillsChild.SourceObject = "subBillsOil"
DoCmd.ApplyFilter "subBillsNew", ""
Case "Cable/Telephone/Internet"
Me.SubBillsChild.SourceObject = "subBillsCable"
DoCmd.ApplyFilter "subBillsNew", ""
Case "Cellphone"
Me.SubBillsChild.SourceObject = "subBillsCell"
DoCmd.ApplyFilter "subBillsNew", ""
Case Else
Me.SubBillsChild.SourceObject = "subBillsMain"
DoCmd.ApplyFilter "subBillsNew", ""
End Select
End If

Amy Blankenship

unread,
Jan 19, 2008, 12:36:47 PM1/19/08
to
Have you tried changing the Cycle property on the form to Current Record
(Other tab)?

<nybase...@gmail.com> wrote in message
news:4e980a93-d07f-4e81...@d21g2000prf.googlegroups.com...

nybase...@gmail.com

unread,
Jan 19, 2008, 1:21:04 PM1/19/08
to
That was exactly what I needed. Thank you Amy.

Amy Blankenship

unread,
Jan 19, 2008, 4:55:07 PM1/19/08
to
You're welcome ;-). I've been asking a lot of questions on the
ms.public.access.* forums lately, so if I can "pay" for it by helping
someone else, that makes me feel better...

<nybase...@gmail.com> wrote in message
news:ddcc6aa3-29ce-4588...@l32g2000hse.googlegroups.com...

0 new messages