UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Dcount In Runtime Access, Access 2016    
 
   
tobyhanna
post Mar 12 2018, 02:50 PM
Post#1



Posts: 131
Joined: 7-February 06



Hello,

Has anyone had issues with Runtime Access 2013 not being able to use DCount()?

I have a form, with a subform that is a datasheet. The user selects one record on the subform and can perform certain things. One is to click an Edit button which opens another form to edit the selected record.

All worked fine until I added a line of code:
CODE
    If DCount("*", Me.frmSubform.Form.RecordSource) = 0 Then Exit Sub


This is the first line in the cmdEdit_Click() event. I ran into a situation where there were no records to display in the subform so I decided to not let the edit window open in that case - which is why I added the above line of code. It works fine for me in both full Access (ACCDB) and running a test of the Runtime (ACCDE). But the client experiences an "ON CLICK" error. This type of error isn't trapped in regular error handling so I can't even see the error log information. Wondering if anyone else has seen this and has any advice? I tried adding "On Error Resume Next" before the line and will see what the client says when they try it out.

My code compiles. I do not have ActiveX controls. The db is split.

Thank you,
Liesl
Go to the top of the page
 
theDBguy
post Mar 12 2018, 03:32 PM
Post#2


Access Wiki and Forums Moderator
Posts: 72,709
Joined: 19-June 07
From: SunnySandyEggo


Hi Liesl,

What happens if you replace the DCount() with a DLookup() call? What happens if you use Date()?

Just trying some troubleshooting steps..

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
tobyhanna
post Mar 12 2018, 03:51 PM
Post#3



Posts: 131
Joined: 7-February 06



Hi DBGuy,

I use DLookup all over the application. No issues that I know of yet. Runtime DOES NOT like Date(). I've replaced all instances of Date() with CDate(DateValue(Now())). Learned that the hard way. I'm able to debug at the DCount line of code and confirm that it works correctly for me. It's the only change I could think of when the client reported clicking that button no longer works.

It's tough to trouble shoot quickly. As I said it works for me both in the regular and Runtime version of Access. My client is in Australia and I'm in the US so it takes time. They will hopefully try my version with the "On Error Resume Next". Was just wondering if this is something I missed in all my searches or if anyone had a work around. I haven't used Runtime in awhile so it's been a learning curve of sorts.

Thanks,
Liesl

Go to the top of the page
 
theDBguy
post Mar 12 2018, 04:10 PM
Post#4


Access Wiki and Forums Moderator
Posts: 72,709
Joined: 19-June 07
From: SunnySandyEggo


Hi Liesl,

My thinking goes something like this...

Errors with "regular" functions like DCount() is usually caused by missing references. Not getting the error on your side means you don't have any missing references. Getting the error on the client side "could" mean they have a missing reference. The problem is because they are using Runtime, there is no way to check if they do and what it might be.

Adding an error handler should help; but, using Resume Next will just hide the problem.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
tobyhanna
post Mar 12 2018, 04:53 PM
Post#5



Posts: 131
Joined: 7-February 06



Hi DBGuy,

Date() is also one of those "regular" functions. I took out as many references as I could. I believe the client is running Office 365 but I'm 100% sure.

The regular error handler I have in place won't trap for the Missing Reference error in Access Runtime, it just says there is an "On Click" error (because the error happens in the OnClick event).

Would reinstalling Access Runtime 2013 help with missing references?

The following are included references:
VBA: C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA7.1\VBE7.DLL
Access: C:\Program Files (x86)\Microsoft Office\Root\Office16\MSACC.OLB
stdole: C:\Windows\SysWOW64\stdole2.tlb
ADOX: C:\Program Files (x86)\Common Files\System\ado\msadox28.tlb
DAO: C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE16\ACEDAO.DLL
VBIDE: C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB
ADODB: C:\Program Files (x86)\Common Files\System\ado\msado15.dll

or in the References window:
Visual Basic for Applications
Microsoft Access 16.0 Object LIbrary
OLE Automation
Microsoft ADO Ext. 2.8 for DDL and Security
Microsoft Office 16.0 Access database engine Object Library
Microsoft Visual Basic for Applicaitons Extensibility 5.3
Microsoft ActiveX Data Objects 6.1 Library

OK, this last one, I said there were not ActiveX objects. Hmmm. I found a module I had to let me know who was connected to the database. Removed that and the reference and any associated code. I will let you know how it goes.

Thsnks for all your insight, always thoughtful and quite helpful!

Liesl
Go to the top of the page
 
theDBguy
post Mar 12 2018, 04:56 PM
Post#6


Access Wiki and Forums Moderator
Posts: 72,709
Joined: 19-June 07
From: SunnySandyEggo


Hi Liesl,

Are you using Access 2016 for development? If so, you should probably be using Runtime 2016 as well (instead of 2013).

Just a thought...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
tobyhanna
post Mar 12 2018, 05:08 PM
Post#7



Posts: 131
Joined: 7-February 06



Agreed. I am developing in Access 2016. Or is it now Access 365?

However, when the client tried to install Access 2016 Runtime, there was the "Click To Run" error (they must be using Office 365 then) and the work around was suggested to use Access 2013 Runtime - https://answers.microsoft.com/en-us/msoffic...71-ecce23d5be21


Go to the top of the page
 
theDBguy
post Mar 12 2018, 05:10 PM
Post#8


Access Wiki and Forums Moderator
Posts: 72,709
Joined: 19-June 07
From: SunnySandyEggo


In my humble opinion, the "proper" workaround should have been to fix the problem with installing the 2016 Runtime. Is there any way for you to develop using Access 2013 then?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
tobyhanna
post Mar 12 2018, 05:15 PM
Post#9



Posts: 131
Joined: 7-February 06



Hi DBGuy,

Somehow I knew that was the next question smile.gif I only have the Office 365 subscription so it's updated whenever Microsoft feels like it.

Thanks again for all you help,
Liesl
Go to the top of the page
 
BruceM
post Mar 13 2018, 07:19 AM
Post#10


UtterAccess VIP
Posts: 7,502
Joined: 24-May 10
From: Downeast Maine


There is an option for the record count that does not involve a domain function at all. You should be able to do:

If Me.frmSubform.Form.RecordsetClone.RecordCount = 0 Then...

You could use Recordset instead of RecordsetClone. I tend to use the Clone unless I am navigating the recordset.

RecordSource is the form's record source, such as a table or query. It is text, and will never be the integer value 0. I expect that is the problem you are having with the DCount.
Go to the top of the page
 
tobyhanna
post Mar 13 2018, 07:57 AM
Post#11



Posts: 131
Joined: 7-February 06



Thanks BruceM. That appears to be my problem exactly. I change the Recordset depending upon search criteria and found that sometimes the dCount() "failed" because the subform.recordset was a SQL statement and not a query or table. I can trap for that error and perform the exit sub or use your suggestion.

Thank you,
Liesl
Go to the top of the page
 
BruceM
post Mar 13 2018, 08:36 AM
Post#12


UtterAccess VIP
Posts: 7,502
Joined: 24-May 10
From: Downeast Maine


QUOTE
I change the Recordset depending upon search criteria

I assume you mean you change the form's record source. That will change the recordset, but that is a different matter. You you were doing a DCount on the RecordSource, which is not the same as the Recordset. You can't do a meaningful DCount, if you can do it at all, on a text value (the RecordSource). That was the point I was making about that. In either case, a form property is not a domain, so I don't think domain functions can be used.
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    17th July 2018 - 10:44 AM