Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / December 2007

Tip: Looking for answers? Try searching our database.

Private Function help

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chad - 18 Dec 2007 21:39 GMT
Hello, Im using a function in my switchboard with two text boxes that
requires me to select dates. Its working fine but I want to have another
section with a differnt area on the same switchboard that will allow me to
choose only one date from a seperate text box. How would I fix the code below
so that it only requires me to have a date in a text box named
txtSupervisors? Thanks!

Private Function ValidDates() As Boolean

   Dim strMsg As String
   
   ValidDates = True
   
   If IsDate(Me.txtStartDate) And IsDate(Me.txtEndDate) Then
       If Me.txtStartDate > Me.txtEndDate Then
           strMsg = "Start Date must be EQUAL TO or LESS THAN End Date."
       End If
   Else
       strMsg = "Both Start and End Dates are Required for the Reports."
   End If
   
   If Len(strMsg) Then
       MsgBox strMsg, vbOKOnly, "Date Entry Error"
       ValidDates = False
   End If
       
End Function
Jeanette Cunningham - 19 Dec 2007 00:31 GMT
Hi Chad,
How many dates are needed to be checked?
Will there be Start date, End date and Supervisor date?
What rule is there about the Supervisor date? Can it be any date? Can it be
blank?

Jeanette Cunningham

> Hello, Im using a function in my switchboard with two text boxes that
> requires me to select dates. Its working fine but I want to have another
[quoted text clipped - 24 lines]
>
> End Function
Chad - 19 Dec 2007 01:30 GMT
I want to only check one text box named txtStartDate instead of two like in
the example. Thanks!
Signature

Newbies need extra loven.........

> Hi Chad,
> How many dates are needed to be checked?
[quoted text clipped - 32 lines]
> >
> > End Function
Jeanette Cunningham - 19 Dec 2007 01:41 GMT
Chad,
try the following code, is this gentle enough for you?

If just checks that the user has chosen a date, and if they haven't, gives
them the message and sets ValidDates to false.

Private Function ValidDates() As Boolean
  Dim strMsg As String

   ValidDates = True

   If IsNull(Me.txtStartDate) Then
           strMsg = "You must choose a start date."
   ElseIf Not IsDate(me.txtStartDate) then
       strMsg = "You must choose a valid date."
   End If

   If Len(strMsg) Then
       MsgBox strMsg, vbOKOnly, "Date Entry Error"
       ValidDates = False
   End If

End Function

>I want to only check one text box named txtStartDate instead of two like in
> the example. Thanks!
[quoted text clipped - 40 lines]
>> >
>> > End Function
Chad - 19 Dec 2007 01:55 GMT
I just didnt get it!!! Thanks....
Signature

Newbies need extra loven.........

> Chad,
> try the following code, is this gentle enough for you?
[quoted text clipped - 64 lines]
> >> >
> >> > End Function
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.