Re: Calculating dates..

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I tried making another form with the query as the record source and I set a
textbox to Expr1 and I just get a blank box. (I have the other form open so
the query can read the combobox that feeds the criteria)


"Allen Browne" wrote:

> You cannot make a new query based on that table, and put the calculated
> field in that query so you can refer to it in your form as well as all the
> other fields you already have?
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Joel" <Joel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:FBB49B1F-570F-4610-A4A1-F6C13FCF6A0E@xxxxxxxxxxxxxxxx
> >I cant change the record source of the form, I need it set to the table it
> > set to.
> >
> > "Allen Browne" wrote:
> >
> >> You need to put that into the query that feeds the form. You can then
> >> just
> >> set the Control Source of the text box to the name of the calculated
> >> field
> >> (Expr1 in your example.)
> >>
> >> It is possible to DLookup() the result from a query, but that seems
> >> pointless when you could include the calculated field in the form's
> >> RecordSource.
> >>
> >> "Joel" <Joel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> >> news:0D437B88-130E-4222-99C9-7D53D9B8C890@xxxxxxxxxxxxxxxx
> >> > Thank you for your responce.
> >> > But Im still having trouble with this. I got the query to work just
> >> > fine
> >> > but
> >> > I cant get the calculated date to show up in a text box on the form or
> >> > a
> >> > report, all I get is #Name?.
> >> > I have the control of that textbox [Text147] set to
> >> > =InspectionFrequencyQuery!Expr1
> >> > Also I have the combobox [InspectionFrequency] set to do a
> >> > requery(Me!Text147.ReQuery) after update.
> >> >
> >> > Thanks
> >> >
> >> > "Allen Browne" wrote:
> >> >
> >> >> Use DateAdd() to add the number of months or years.
> >> >>
> >> >> Joel, you probably have a table for the InspectionFrequency dates.
> >> >> How about adding 2 more fields to the table:
> >> >> PeriodType
> >> >> Freqency
> >> >> The PeriodType will contain the text DateAdd needs, e.g. "m", "yyyy",
> >> >> "d",
> >> >> "q".
> >> >> The Frequency is the number of periods.
> >> >> Example data:
> >> >> 3 months m 3
> >> >> 6 monhts m 6
> >> >> 1 year yyyy 1
> >> >> 5 years yyyy 5
> >> >>
> >> >> Now you can make a query that contains both tables, and create a
> >> >> calculated
> >> >> field by typing this into a fresh column in the Field row:
> >> >> DateAdd([PeriodType], [Frequency], [InspectionDate])
> >> >>
> >> >> "Joel" <Joel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> >> >> news:1AE960E2-7BF3-458A-BE5C-8D228AEFFDBF@xxxxxxxxxxxxxxxx
> >> >> >I need to have a textbox display a calculated date from another field
> >> >> >in
> >> >> >my
> >> >> > report.
> >> >> >
> >> >> > ex: User types in the date [InspectionDate] on the form, then they
> >> >> > select
> >> >> > the inspection frequency ([InspectionFrequency] values are 3 months,
> >> >> > 6m,
> >> >> > 1y,2y,3y,4y,5y, and 10y and each has a unique id).
> >> >> >
> >> >> > Now in my report i need the [InspectionDate] to add the
> >> >> > [InspectionFrequency] and display in the report.
> >> >> >
> >> >> > Thanks.
>
>
>
.



Relevant Pages

  • Re: Return to form if query unmatched
    ... Your query (Form's Record Source) return read-only list, ... Dim MyRecCount As Long ... If it doesn't pop up a message and set Cancel = True. ...
    (microsoft.public.access.queries)
  • RE: Tables and Forms
    ... Dave Hargis, Microsoft Access MVP ... record source of my form to go to the query. ... You will see the name of the table in the Record Source property. ...
    (microsoft.public.access.gettingstarted)
  • RE: Tables and Forms
    ... record source of my form to go to the query. ... You will see the name of the table in the Record Source property. ... Dave Hargis, Microsoft Access MVP ...
    (microsoft.public.access.gettingstarted)
  • RE: Tables and Forms
    ... You will see the name of the table in the Record Source property. ... query for the table. ... Dave Hargis, Microsoft Access MVP ...
    (microsoft.public.access.gettingstarted)
  • RE: Combo Box Problem
    ... "Your Record Source query doesn't appear to have an filter. ... record source query it won't display in the report? ... "Duane Hookom" wrote: ...
    (microsoft.public.access.reports)