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 / Forms / May 2007

Tip: Looking for answers? Try searching our database.

Acess Form & subForms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
train.fan#007 - 30 May 2007 08:40 GMT
Hi, I hope someone can help me.
I have one main form, with four, at least, other forms
within.
The problem is:
I wish to pre-select one form to suit the day of the week.

Explanation:
I have 8 queries based on availability.
I now wish to select, based on which ever day of the week, the correct
query for the particular day.

If anyone can advise me on how to select the
desired query i would be very grateful.

Thanks in advance

Exilescot
Brendan Reynolds - 30 May 2007 13:09 GMT
> Hi, I hope someone can help me.
> I have one main form, with four, at least, other forms
[quoted text clipped - 13 lines]
>
> Exilescot

I'm not quite sure what it is that you want to do with the query. It is not
clear to me just what you mean by 'select' in this context. I'm going to
take a guess that possibly you want to assign the name of a query to the
record source property of a form? In that case, the code might look
something like so ...

Select Case WeekdayName(Weekday(Date, vbUseSystemDayOfWeek), False,
vbUseSystemDayOfWeek)
Case "Monday"
   Me.sfrSomeSubFormControl.Form.RecordSource = "qryQueryForMonday"
Case "Tuesday"
   Me.sfrSomeSubFormControl.Form.RecordSource = qryQueryForTuesday"
'etc
End Select

It's difficult to be sure without more information, but it sounds quite
probable that the goal could be achieved with a single parameter query,
something like ...

SELECT * FROM SomeTable WHERE SomeColumn = WeekdayName(Weekday(Date, 0),
False, 0)

Note that the WeekDay function defaults to using vbSunday as the first day
of the week, while the WeekDayName function defaults to using
vbUseSystemDayOfWeek, so it's important to specify the same value for the
two function calls, otherwise you get unexpected results on a system where
Sunday is not the first day of the week.

Signature

Brendan Reynolds

train.fan#007 - 31 May 2007 15:43 GMT
>> Hi, I hope someone can help me.
>> I have one main form, with four, at least, other forms
[quoted text clipped - 41 lines]
> the two function calls, otherwise you get unexpected results on a
> system where Sunday is not the first day of the week.

Hi & thanks Brendan,
I should have made the question clearer.
Here goes again:-
I have a main Form, on which I have many sub-forms.

1 subFrom, I would like to be able to choose from a varible amount of
date based columns from one table  eg  driversName, 270507, 280507,
290507, 300507, 310507 etc.

I would like to have showing, on the subform, the driversname and todays
date column.
If you could help I will be well chuffed. thanks in advance
Exilescot.
 
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



©2009 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.