Dlookup fails with 2 compo boxes

  • Thread starter Gaetanm via AccessMonster.com
  • Start date
G

Gaetanm via AccessMonster.com

I have a form with two combo boxes and associated text fields.

cboJobID {text box brings up job description from JobId #}
cboEmployeeID {text box bings up employee name}

I created another text box [work hours this week] with a Dlookup
to a query this gives me the total time the cboEmployeeID has worked
this week. This works fine.

The problem occurs if I pull the cboJobID first then the cboEmployeeID
the text field [work hours this week] is left blank. But if I pull
cboEmployeeId first then then the cboJobId next i get my hours.

This is a input form that will update a table with the jobId, EmpId,
Startdate. The hours worked on the form is for visual reference purposes.

I also plan to display the total time that has accumulated
on the jobID and also the total time that has accumulted on
the jobID that the EmployeeID has accrode.

in the form control source [work hours this week] i put this in
=DLookUp("SumOfTotalHoursMinutes","Time_minutes")

The time_minutes query looks like this:

SELECT Clock_table.EmployeeID, Clock_table.StartDate, Clock_table.StopDate,
DateDiff("n",[Startdate],[Stopdate])\60 & Format(DateDiff("n",[Startdate],
[Stopdate]) Mod 60,"\:00") AS SumOfTotalHoursMinutes
FROM Clock_table
WHERE (((Clock_Table.StopDate)>Date()-Weekday(Date()+1))) And
EmployeeID=Forms!frmClock_Start_Table!cboEmployeeId;

So where am I going wrong? Plus what pit falls my I encounter
when I try to do the same thing with cboJobId.

Any insight would greatly be appreciated

Thanks

Gaetanm
 
T

TonyT

Hi Gaetman,

replies in line below,

Gaetanm via AccessMonster.com said:
I have a form with two combo boxes and associated text fields.

cboJobID {text box brings up job description from JobId #}
cboEmployeeID {text box bings up employee name}

I created another text box [work hours this week] with a Dlookup
to a query this gives me the total time the cboEmployeeID has worked
this week. This works fine.

The problem occurs if I pull the cboJobID first then the cboEmployeeID
the text field [work hours this week] is left blank. But if I pull
cboEmployeeId first then then the cboJobId next i get my hours.

in the afterUpdate event of both comboboxes put;
Me.[work hours this week].Requery
this will force the control to be re-evaluated each time the selection in
either combobox changes.
This is a input form that will update a table with the jobId, EmpId,
Startdate. The hours worked on the form is for visual reference purposes.

I also plan to display the total time that has accumulated
on the jobID and also the total time that has accumulted on
the jobID that the EmployeeID has accrode.
This could be done in the same way, only referring to the newly created
query that claculates the information you require.
in the form control source [work hours this week] i put this in
=DLookUp("SumOfTotalHoursMinutes","Time_minutes")

The time_minutes query looks like this:

SELECT Clock_table.EmployeeID, Clock_table.StartDate, Clock_table.StopDate,
DateDiff("n",[Startdate],[Stopdate])\60 & Format(DateDiff("n",[Startdate],
[Stopdate]) Mod 60,"\:00") AS SumOfTotalHoursMinutes
FROM Clock_table
WHERE (((Clock_Table.StopDate)>Date()-Weekday(Date()+1))) And
EmployeeID=Forms!frmClock_Start_Table!cboEmployeeId;

So where am I going wrong? Plus what pit falls my I encounter
when I try to do the same thing with cboJobId.

Any insight would greatly be appreciated

Thanks

Gaetanm

hope this helps,

TonyT..
 
G

Gaetanm via AccessMonster.com

TonyT said:
Hi Gaetman,

replies in line below,
I have a form with two combo boxes and associated text fields.
[quoted text clipped - 8 lines]
the text field [work hours this week] is left blank. But if I pull
cboEmployeeId first then then the cboJobId next i get my hours.

in the afterUpdate event of both comboboxes put;
Me.[work hours this week].Requery
this will force the control to be re-evaluated each time the selection in
either combobox changes.
This is a input form that will update a table with the jobId, EmpId,
Startdate. The hours worked on the form is for visual reference purposes.

I also plan to display the total time that has accumulated
on the jobID and also the total time that has accumulted on
the jobID that the EmployeeID has accrode.

This could be done in the same way, only referring to the newly created
query that claculates the information you require.
in the form control source [work hours this week] i put this in
=DLookUp("SumOfTotalHoursMinutes","Time_minutes")
[quoted text clipped - 16 lines]

hope this helps,

TonyT..

Thanks TOny

That worked great Now if I can only wish that I could be as succesful
with Stephen Lebans Mouse wheel it does not appear to work
on my form

Thanks again

Gaetan
 

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

Similar Threads

Weekday 0
Query that seems impossible 8
Query and time 0
Update table from form combo 9
Cartesian Help Please 5
Data Type Mismatch in Criteria expression 6
Text update from form 4
dlookup or dsum 4

Top