Continuous Form - Dynamic Text Box Update

A

Alan

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
 
S

Steve Sanford

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
 
J

Jan Baird

Jan Baird is out of the country until September 20. Every effort will be
made to respond to messages, but please be patient.
 
J

Jan Baird

Jan Baird is out of the country until September 20. Every effort will be
made to respond to messages, but please be patient.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top