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 Programming / May 2008

Tip: Looking for answers? Try searching our database.

Continuous Form - Dynamic Text Box Update

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alan - 22 May 2008 22:39 GMT
Hello

Dont know if this is possible
I am trying to create a continuous form that contains staff details and
daily shift times. I would like to be able to update a text box on the form
for each record dependant on the shift worked.

I have set the control source for the Form to subtract the Start Time from
The End Time in order to establish the hours worked and the apprpriate shift.
The HR data I am using recoirds a day off as being from 0700 to 0700 and thus
if the subtraction = 0 then I would like the text box to read day off but if
the shift shows 0700 to 1500 then I would like it to read Early.

I dont know if this is possible in a continuous form, but seeking a solution
without having to amend the core data table.
I hope this makes sense

Many Thanks as always

Signature

Regards

Alan

Steve Sanford - 26 May 2008 08:25 GMT
Hi Allan,

I needed to do something like this.. There are a couple of ways to do it.

One way is to add a calculated column in the query for the form.

Shift: IIF( [End] - [Start] = 0,"Day Off",IIF([Start]=0700 AND
[End]=1500,"Early","OOPS" )

Another way is to write a function. In an empty column in the query, enter:

Shift: GetShift([Start],[End])

The function would look something like:

'**** UNTESTED************
Function GetShift(pStart As Date, pEnd As Date) As String

 If pStart = 0700 And pEnd = 0700 Then
   GetShift = "Day Off"
 ElseIf pStart = 0700 And pEnd = 1500 Then
   GetShift  = "Early"
 Else
  GetShift = "OOPS"
 End IF

End Function
'********************

With the function, it is easier to add many more tests.

With either way, on the form, add a text box and set the control source to
the field "Shift" (or what ever name you named it). BTW, this works in
reports also..

HTH
Signature

Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)

> Hello
>
[quoted text clipped - 14 lines]
>
> Many Thanks as always
Jan Baird - 27 May 2008 20:51 GMT
Jan Baird is out of the country until September 20.   Every effort will be
made to respond to messages, but please be patient.
Jan Baird - 27 May 2008 20:51 GMT
Jan Baird is out of the country until September 20.   Every effort will be
made to respond to messages, but please be patient.
 
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.