Code Help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

With the following code I'm checking to see if the patient has a prior visit.
If not, I want to set the date picker control to today's date. My code works
fine for doing that. What I need hlp with is the Else statement. If the
patient does have a prior visit, what do I put after the =, it should read;
else, load the patient's visit dates, or do the standard thing as if the code
wasn't there to beging with. Hope that's clear.

Thanks, Rob


If (DCount("*", "[qryVisitList]") < 1) Then
Me.frmVisitNewEdit.Form.DTPicker7.Value = Date
Else: Me.frmVisitNewEdit.Form.VisitDate = ??????
End If
 
Dear Rob,

You don't need an else clause. This is ok:

If (DCount("*", "[qryVisitList]") < 1) Then
Me.frmVisitNewEdit.Form.DTPicker7.Value = Date
End If
 
Thanks Sam, the problem is, after I go to a patient who has no visit records,
and then go to a pt who has a visit record, the visit date = today rather
than the actual visit date. Thus, I thought I might need an else. Any
suggestions? Thanks again, Rob

Mark A. Sam said:
Dear Rob,

You don't need an else clause. This is ok:

If (DCount("*", "[qryVisitList]") < 1) Then
Me.frmVisitNewEdit.Form.DTPicker7.Value = Date
End If



RobUCSD said:
With the following code I'm checking to see if the patient has a prior
visit.
If not, I want to set the date picker control to today's date. My code
works
fine for doing that. What I need hlp with is the Else statement. If the
patient does have a prior visit, what do I put after the =, it should
read;
else, load the patient's visit dates, or do the standard thing as if the
code
wasn't there to beging with. Hope that's clear.

Thanks, Rob


If (DCount("*", "[qryVisitList]") < 1) Then
Me.frmVisitNewEdit.Form.DTPicker7.Value = Date
Else: Me.frmVisitNewEdit.Form.VisitDate = ??????
End If
 
Rob,

I'm not sure I understand you, but if you are saying that if a patient now
no visit records the date should be the current date otherwise the last
visit date, then do find that date using DMax on your query.

God Bless,

Mark

RobUCSD said:
Thanks Sam, the problem is, after I go to a patient who has no visit
records,
and then go to a pt who has a visit record, the visit date = today rather
than the actual visit date. Thus, I thought I might need an else. Any
suggestions? Thanks again, Rob

Mark A. Sam said:
Dear Rob,

You don't need an else clause. This is ok:

If (DCount("*", "[qryVisitList]") < 1) Then
Me.frmVisitNewEdit.Form.DTPicker7.Value = Date
End If



RobUCSD said:
With the following code I'm checking to see if the patient has a prior
visit.
If not, I want to set the date picker control to today's date. My code
works
fine for doing that. What I need hlp with is the Else statement. If
the
patient does have a prior visit, what do I put after the =, it should
read;
else, load the patient's visit dates, or do the standard thing as if
the
code
wasn't there to beging with. Hope that's clear.

Thanks, Rob


If (DCount("*", "[qryVisitList]") < 1) Then
Me.frmVisitNewEdit.Form.DTPicker7.Value = Date
Else: Me.frmVisitNewEdit.Form.VisitDate = ??????
End If
 
Yea, this is confusing. What I want is if there is no prior visit, then the
DTpicker control should display today's date, not actually enter in today's
date into the visitDate fld. What happens now is that the date picker
displays the prior patient's visit date when there is no visit history, it
doesn't actually enter that date into the record, which is good. I just want
the date picker control to display today's date if there is no visit date.
Thanks, Any ideas?

Rob

Mark A. Sam said:
Rob,

I'm not sure I understand you, but if you are saying that if a patient now
no visit records the date should be the current date otherwise the last
visit date, then do find that date using DMax on your query.

God Bless,

Mark

RobUCSD said:
Thanks Sam, the problem is, after I go to a patient who has no visit
records,
and then go to a pt who has a visit record, the visit date = today rather
than the actual visit date. Thus, I thought I might need an else. Any
suggestions? Thanks again, Rob

Mark A. Sam said:
Dear Rob,

You don't need an else clause. This is ok:

If (DCount("*", "[qryVisitList]") < 1) Then
Me.frmVisitNewEdit.Form.DTPicker7.Value = Date
End If



With the following code I'm checking to see if the patient has a prior
visit.
If not, I want to set the date picker control to today's date. My code
works
fine for doing that. What I need hlp with is the Else statement. If
the
patient does have a prior visit, what do I put after the =, it should
read;
else, load the patient's visit dates, or do the standard thing as if
the
code
wasn't there to beging with. Hope that's clear.

Thanks, Rob


If (DCount("*", "[qryVisitList]") < 1) Then
Me.frmVisitNewEdit.Form.DTPicker7.Value = Date
Else: Me.frmVisitNewEdit.Form.VisitDate = ??????
End If
 
Hello Rob,

I am just guessing at the syntax here, but what if I am readindg you
correctly, you need to fet the format property something like this:

Dim MyDate As Date

MyDate = Date

If (DCount("*", "[qryVisitList]") < 1) Then

frmVisitNewEdit.Form!DTPicker7.Format = "@;" & MyDate

End If

Note I removed the Me. from the expression and replaced the .DTPicker7

with !DTPicker7 ( . With ! )

Me. Is not required. I have only seen where it could be used, once in my

life and forgot how, but you don't need to bother typing it in. Using the
bang (!) is proper form to connect a Form with a control. So the syntax
would be FormName.Form!Controlname

Hope that helps.

God Bless,

Mark



RobUCSD said:
Yea, this is confusing. What I want is if there is no prior visit, then
the
DTpicker control should display today's date, not actually enter in
today's
date into the visitDate fld. What happens now is that the date picker
displays the prior patient's visit date when there is no visit history, it
doesn't actually enter that date into the record, which is good. I just
want
the date picker control to display today's date if there is no visit date.
Thanks, Any ideas?

Rob

Mark A. Sam said:
Rob,

I'm not sure I understand you, but if you are saying that if a patient
now
no visit records the date should be the current date otherwise the last
visit date, then do find that date using DMax on your query.

God Bless,

Mark

RobUCSD said:
Thanks Sam, the problem is, after I go to a patient who has no visit
records,
and then go to a pt who has a visit record, the visit date = today
rather
than the actual visit date. Thus, I thought I might need an else. Any
suggestions? Thanks again, Rob

:

Dear Rob,

You don't need an else clause. This is ok:

If (DCount("*", "[qryVisitList]") < 1) Then
Me.frmVisitNewEdit.Form.DTPicker7.Value = Date
End If



With the following code I'm checking to see if the patient has a
prior
visit.
If not, I want to set the date picker control to today's date. My
code
works
fine for doing that. What I need hlp with is the Else statement. If
the
patient does have a prior visit, what do I put after the =, it
should
read;
else, load the patient's visit dates, or do the standard thing as if
the
code
wasn't there to beging with. Hope that's clear.

Thanks, Rob


If (DCount("*", "[qryVisitList]") < 1) Then
Me.frmVisitNewEdit.Form.DTPicker7.Value = Date
Else: Me.frmVisitNewEdit.Form.VisitDate = ??????
End If
 

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


Back
Top