DCount Expression Help Needed

D

Dave Elliott

I have my main for named TimeCards and on it is a sub-form named Time and
Hours
On the main for there is a control named Rate which shows the customers rate
On the sub-form there is a control named EmployeeID which looks up the
employee fore the TimeCard

If there is only (1) One employee on the job,then I need to adjust the Rate
on the main form to
Text430 which is on the main form *2
This needs to requery so that if more than one (1) employee is added , then
it does nothing and lets the normal
code run.
On the main form on the after update event this code runs to change the Rate
to be what it should be when a customer is added.
Rate = [Text430]
I guess I need an else statement to put it back to Rate = [Text430] when
more than (1) employee is added to the Time and Hours form.

If DCount([EmployeeID], "Time_Hours", [EmployeeID] < 2 ) Then
Rate = [Text430] * 2
End If
 
D

Dave Elliott

Tried this as well with no success.

If Forms!TimeCards![Time_Hours].Form![Text95].Value < 2 Then
Rate = [Text430] * 2
Else
Rate = [Text430]
End If
 
F

fredg

I have my main for named TimeCards and on it is a sub-form named Time and
Hours
On the main for there is a control named Rate which shows the customers rate
On the sub-form there is a control named EmployeeID which looks up the
employee fore the TimeCard

If there is only (1) One employee on the job,then I need to adjust the Rate
on the main form to
Text430 which is on the main form *2
This needs to requery so that if more than one (1) employee is added , then
it does nothing and lets the normal
code run.
On the main form on the after update event this code runs to change the Rate
to be what it should be when a customer is added.
Rate = [Text430]
I guess I need an else statement to put it back to Rate = [Text430] when
more than (1) employee is added to the Time and Hours form.

If DCount([EmployeeID], "Time_Hours", [EmployeeID] < 2 ) Then
Rate = [Text430] * 2
End If

Each argument must be a string.

If DCount("*", "Time_Hours","[EmployeeID] < 2") Then
etc.
 

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