You're welcome, Jim. And thanks for the kind words.
-Bill
--- In MS_Access_Professionals@yahoogroups.com, Jim Wagner <luvmymelody@...> wrote:
>
> Bill,
>
> That is some sweet code. Thank You
> Â
> Jim Wagner
> ________________________________
>
>
>
> ________________________________
> From: Bill Mosca <wrmosca@...>
> To: MS_Access_Professionals@yahoogroups.com
> Sent: Friday, August 2, 2013 9:33 AM
> Subject: [MS_AccessPros] Re: Executing a query
>
>
>
> Â
> Phucon
>
> Yes, You have to update the table each year. One way to do it is to use your startup form to check if the table is current or not. If it isn't in the table then add it.
>
> Private Sub Form_Load()
> Dim strSQL as String
> Dim strYear as String
>
> strYear=Format(DateSerial(Year(Date())+YearNum,1,1),"yyyy")
>
> If DCount("*", "tblYears", "[Year]=" & strYear)<>0 Then
> strSQL = "INSERT into tblYears([Year]) " _
> & "VALUES(Format(DateSerial(Year(Date())+YearNum,1,1),'yyyy'))"
> CurrentDB.Execute strSQL
> End If
>
> End Sub
>
> Regards,
> Bill Mosca, Founder - MS_Access_Professionals
> http://www.thatlldoit.com
> Microsoft Office Access MVP
> https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-64270730881E
> My nothing-to-do-with-Access blog
> http://wrmosca.wordpress.com
>
> --- In MS_Access_Professionals@yahoogroups.com, "saigonf7q5" <saigonf7q5@> wrote:
> >
> > I uses this query 'SELECT Format(DateSerial(Year(Date())+YearNum,1,1),"yyyy") AS [Year] FROM tblYears;' as a combobox's rowsource which will dropdown a list of years.
> >
> > For example the combobox containing the list 2011, 2012, 2013. So when the current year's reaches to the end and turns into a new year, and when the combobox's executed (On Click), the year list will not be automatically updated to 2012, 2013, 2014 will it? I guess I have to executed the query each time when it's reaching a new year? How do I execute that query?
> >
> > Thank you
> >
> > Phucon
> >
>
>
>
>
> [Non-text portions of this message have been removed]
>
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (4) |
Tidak ada komentar:
Posting Komentar