If And Statement

D

Douglas J. Steele

You need to use And, not &

If IsNull(Forms!fttWorkLogHiddenOpen!StopTime) And _
(Forms!fttWorkLogHiddenOpen!CboTech) = Forms!fttswitchboard!CboTech Then
DoCmd.OpenForm "fttWorkLogReminder", , , "tech='" &
Forms!fttswitchboard!CboTech & "'"
Else
DoCmd.OpenForm "fGenInfoTT", , , "jobnumber=" & Me!JobNumber
End If
 
P

Pam

Hello,

Can someone please tell my why this code will not open the Reminder form
when StopTime is blank for the tech selected? It goes straight to the
GenInfo form.

If IsNull(Forms!fttWorkLogHiddenOpen!StopTime) & _
(Forms!fttWorkLogHiddenOpen!CboTech) = Forms!fttswitchboard!CboTech Then
DoCmd.OpenForm "fttWorkLogReminder", , , "tech='" &
Forms!fttswitchboard!CboTech & "'"
Else
DoCmd.OpenForm "fGenInfoTT", , , "jobnumber=" & Me!JobNumber
End If

Thanks in advance.
Pam
 
P

Pam

I still can't get it to work as needed. If Tech has time running on job and
starts another job, WorkLogReminder should pop-up with open time based on
null stop time and tech name on WorkLogHiddenOpen. Sometimes it will pop-up
and others it will go right to the GenInfo form with the subform for time
entry. The subform for time entry and the hidden open form are both based
on the same query. I thought maybe it was an update (requery) issue, but I
just closed the db with null stop time and went back in and it went straight
to the time entry form - not catching that there was time running on another
job.

Do you have any suggestions to what I might be doing wrong?
Thanks for your help.
Pam
 
D

Douglas J. Steele

Are you certain that Forms!fttWorkLogHiddenOpen!CboTech equals
Forms!fttswitchboard!CboTech?

With the form open, if you go to the Immediate Window (Ctrl-G), what values
do you see?
 
P

Pam

I have the immediate window at the vba code screen and both switchboard and
workloghiddenopen are open, but there is nothing in the immediate window. I
selected a tech and still nothing.
 
P

Pam

If I remove the line of code Forms!fttWorkLogHiddenOpen!CboTech equals
Forms!fttswitchboard!CboTech and I have two techs (TechA & TechB) with time
running...

I can select TechA and a job for TechA and the reminder opens to TechA's
name and running time. I can close the reminder form without entering stop
time for TechA.

I can select TechB and a job for TechB and the reminder opens to TechB's
name and running time. I can enter stop time for TechB, go back to
switchboard and select TechB and a job and it will go to the time entry
form. This is correct.

But, now when I go to TechA who still has running time, it goes straight to
the time entry form.

I have went round and round with this and it is very frustrating. I know I
have something set up wrong but I can't figure out what it is.

Pam
 

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

Repost - Open Form 9
What Am I Missing? 2
Syntax error (missing operator) 4
Parameter Value?? 10
View Records for Editing Only 1
Prompt for Parameter Value Help 6
Parameter Value Help 1
Set Focus 2

Top