Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function not getting any feedback

Status
Not open for further replies.

BrazilTechie

Programmer
Nov 13, 2002
88
0
0
BR
Hi all:

I need to print a report and stop processing if there are duplicate in my table.

From the code I call a function which will open such report and if there is no data set flag to go on.
When there is data to be displayed (meaning there are duplicates) all is going fine.

The problem is that when there is no data I coded the "cancel = true" on the "nodata" event. That is causing my function not to get any feedback.
The Glob_IntCount is the number of duplicates.

Can you show me the solution for this problem?

This is the function:

Function Check4Dups(Glob_Continue_flag)

DoCmd.OpenReport "rptDuplicatesInTablePhone", acViewPreview

If Glob_IntCount >= 1 Then
Glob_Continue_flag = False
Else
Glob_Continue_flag = True
End If

End Function


Thanks in advance.

BrazilTechie


 
It is possible Glob_IntCount is null.

Where you update / assign a value to Glob_IntCount use...

= NZ(Glob_IntCount, 0)

...this way, a null value will be assigned 0

 
I think I have pinpointed the problem:

I am not being able to get the real count of duplicate records with this sql that I copied from the queries screen (which works OK if submitted there). But it needs to be part of this code.

When the report is requested, the user needs to enter paid_date, but the filter using the code below is not working. I am using this on the OnOpen.

Me.RecordSource = "SELECT First(Phone.MOBILE_PHO) AS [MOBILE_PHO Field], Count(Phone.MOBILE_PHO) AS NumberOfDups, Phone.PAID_DATE FROM Phone GROUP BY Phone.PAID_DATE, Phone.MOBILE_PHO HAVING (((Count(Phone.MOBILE_PHO))>1) AND ((Phone.PAID_DATE)=[Enter the PAID_BY Date to check for duplicates]));"

See if that helps.

Thanks.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top