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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Browsing UPCHKD 2

Status
Not open for further replies.

Bluejay07

Programmer
Mar 9, 2007
780
CA
Hello,

I'm trying to browse UPCHKD although after I hit the .fetch it just goes to the end with area. I can get the query to work in SQL.

What am I missing?
Code:
   Dim UPCHKD As AccpacCOMAPI.AccpacView
   Dim UPCHKH As AccpacCOMAPI.AccpacView

   cNIBDBLINK.OpenView "UP0048", UPCHKH
   cNIBDBLINK.OpenView "UP0049", UPCHKD
   UPCHKH.Compose Array(UPCHKD, Nothing, Nothing, Nothing, Nothing)
   UPCHKD.Compose Array(UPCHKH, Nothing, Nothing)
   With UPCHKD
      .Browse "(PEREND >= '" & Format(pzeDate.Text, "yyyymmdd") & "') and (PEREND <= '" & Format(pzeEndDate.Text, "yyyymmdd") & "') and (EARNDED = 'NIB')", True
            
       Do While .Fetch

If at first you don't succeed, then sky diving wasn't meant for you!
 
If you .Compose views, then you need to .Browse the header first. Or don't .Compose in the first place.
 
Hi Tuba,

Thanks.
I originally had it with just the details and it still have the same result.
That's when I added the header and the compositions.



If at first you don't succeed, then sky diving wasn't meant for you!
 
Then I don't know why it's not working. FYI, I've been programming Accpac US Payroll macros since '99, even before the COMAPI, so Occam's razor says you're missing something simple.
 
.Fetch is forward browsing only, so if the record you seek is before the current record then you are not going to get a result.
.Cancel clears the record and starts at the beginning of the pile.

Sage 300 Certified Consultant
 
Thanks for the replies.
I've used similar code before, that's why I'm confused why it's not working.
It's supposed to be a simple routine and there is no other code.

I think I had also tried a .cancel although I can try again.

Thanks.



If at first you don't succeed, then sky diving wasn't meant for you!
 
PEREND is not text: PEREND >= [highlight #FCE94F]'[/highlight]" & Format(pzeDate.Text, "yyyymmdd") & "[highlight #FCE94F]'[/highlight])
Try PEREND >= " & Format(pzeDate.Text, "yyyymmdd") & ")

Sage 300 Certified Consultant
 
And if you're just pulling a list of records regardless of the cheque that the transaction was on then consider using CS0120 instead of searching transaction by transaction.
 
Hi DjangMan,

I've used CS0120 in the past although I want to figure out what is wrong with the use of the views.

I went back to basics and it still doesn't work.
Here is the code:
Code:
Dim UPCHKD As AccpacCOMAPI.AccpacView

On Error GoTo ERR_Handler
   
cNIBDBLINK.OpenView "UP0049", UPCHKD
With UPCHKD
   .Cancel
   .Browse "EARNDED='NIB'", True
   Do While .Fetch
      ...
   Loop
End With

SQL shows almost 600 records but my .fetch never works.


If at first you don't succeed, then sky diving wasn't meant for you!
 
.Browse "EARNDED=""NIB""", True

Sage 300 Certified Consultant
 
Thank you for all replies.
It appears the single quotes were my problem for both the dates and the earnings code.

Thank you.

If at first you don't succeed, then sky diving wasn't meant for you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top