A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

If And Statement



 
 
Thread Tools Display Modes
  #1  
Old March 11th, 2010, 03:26 PM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default If And Statement

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


--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"Pam" wrote in message
...
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



  #2  
Old March 11th, 2010, 03:36 PM posted to microsoft.public.access.forms
Pam
external usenet poster
 
Posts: 131
Default If And Statement

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


  #3  
Old March 11th, 2010, 05:31 PM posted to microsoft.public.access.forms
Pam
external usenet poster
 
Posts: 131
Default If And Statement

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



"Douglas J. Steele" wrote in message
...
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


--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"Pam" wrote in message
...
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





  #4  
Old March 11th, 2010, 07:05 PM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default If And Statement

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?

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"Pam" wrote in message
...
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



"Douglas J. Steele" wrote in message
...
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


--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"Pam" wrote in message
...
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







  #5  
Old March 11th, 2010, 07:58 PM posted to microsoft.public.access.forms
Pam
external usenet poster
 
Posts: 131
Default If And Statement

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.


"Douglas J. Steele" wrote in message
...
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?

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"Pam" wrote in message
...
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



"Douglas J. Steele" wrote in message
...
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


--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"Pam" wrote in message
...
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









  #6  
Old March 11th, 2010, 09:17 PM posted to microsoft.public.access.forms
Pam
external usenet poster
 
Posts: 131
Default If And Statement

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


"Douglas J. Steele" wrote in message
...
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?

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"Pam" wrote in message
...
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



"Douglas J. Steele" wrote in message
...
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


--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"Pam" wrote in message
...
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









 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:53 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.