I tried both Integer and Long. Neither worked. I got Data Type Mismatch each time. The only thing that worked was LongPtr.
I tried both Integer and Long. Neither worked. I got Data Type Mismatch each time. The only thing that worked was LongPtr.
Try this:
Dim i As Long
RptRec.MoveFirst
For i = 0 To RptRec.RecordCount - 1
If RptRec("Quarter") = Qtr And RptRec("Provider_Id") = CLng(provider_ID) Then
BTW why are you using ADODB?
Funny, I saw that right in the beginning and didn't like it, but since the thread went the way of API's and such (and I had nothing to offer) I figured it wasn't an issue. I would have wrote it as To (rptRec.RecordCount -1) or (rptRec.RecordCount) -1
but I'd also be concerned that you don't seem to be allowing for the possibility that the count is zero. Did you verify that by stepping through that procedcure? Also, by not moving last (getting the count) before moving first, the expression would be 1-1 = 0
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
Micron may well be correct or try For I=1 To RptRec.RecordCount
Can you confirm that you do have a reference for ADO.
BTW I wrote CLng. CLong doesn't exist and will error
I noticed that Micron, but till this upgrade it never came up. This code was written long before I came on board. I only fix things that are broke and this never attracted my attention.
This could have turned out better. I thought I had it licked when my accdb compiled and worked with both 32 bit and 64 bit Access, but not so fast. When I made the ACCDE using the 32bit machine it would only work with 32 bit Access. The same with 64 bit, so I am unable to make an ACCDE that works on both version. I went ahead and distributed the ACCDB so the users would be able get their work done, but I don't like this solution. There must be a way of doing this, but I don't know what it is.
That's normal. I develop in 32bit, compile a 32bit accde. I copy the accdb to a 64bit machine and compile a 64bit accde there. I end up with 2 accde files, my version control utility knows which to grab.
The point of this exercise was to have one version that would work for both. My thinking was that if the ACCDB worked for both, that the ACCDE would as well, but that is not the case. No time now to set up a version control installation. Maybe I can address that later.
More info here:
https://www.devhut.net/2017/04/13/ac...compatibility/
and also confirms that accde files must be compiled on the target version. As far as I know, if you run accde files in a mixed environment you need 2 files.