[AccessD] Odd Error - Embarrassing Workaround

Rocky Smolin rockysmolin at bchacc.com
Mon Dec 4 13:11:50 CST 2017


Decompiled, decorrupted, lit votive candle,  nothing worked.  Except that
screwy workaround.

R


-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Heenan, Lambert
Sent: Monday, December 04, 2017 9:42 AM
To: 'Access Developers discussion and problem solving'; 'Off Topic'
Subject: Re: [AccessD] Odd Error - Embarrassing Workaround

Sounds like it's time to decompile the application. :-)

Lambert 

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Rocky Smolin
Sent: Tuesday, November 28, 2017 11:24 AM
To: 'Access Developers discussion and problem solving'; 'Off Topic'
Subject: [AccessD] Odd Error - Embarrassing Workaround

Dear Lists:

 

In the code below which is in the after update event of a combo box, I want
to position the form to the selected vendor in the combo box list.  Cookie
cutter.  Done it a hundred times:

 

Private Sub cboVendors_AfterUpdate()

 

    If IsNull(cboVendors) Then Exit Sub

    

    lngID = Val(Me.cboVendors.Column(0))

    Set rsMe = Me.RecordsetClone

    

    rsMe.FindFirst "fldVendorID= " & lngID

    If rsMe.NoMatch = True Then

        MsgBox "Record Not Found", vbExclamation

    Else

        Me.Bookmark = rsMe.Bookmark

    End If

    

    Me.cmdExit.SetFocus

    Me.cboVendors.Visible = False

 

End sub

 

The code's a little more wordy than it needs to be because I've been trying
various fixes which, while they shouldn't work, often do in Access. J

 

It blows up on Me.Bookmark = rsMe.Bookmark with an error 2001: You canceled
the previous operation.

 

So here's the odd thing: if I click Debug and see that line highlighted,
then click F5, the code carries on and displays the selected record.

 

I've got a workaround that's so esthetically and professionally offensive
that I hesitate to show it here, but we're all friends, right?

 

Private Sub cboVendors_AfterUpdate()

 

    If IsNull(cboVendors) Then Exit Sub

    

    lngID = Val(Me.cboVendors.Column(0))

    Set rsMe = Me.RecordsetClone

    

    rsMe.FindFirst "fldVendorID= " & lngID

    If rsMe.NoMatch = True Then

        MsgBox "Record Not Found", vbExclamation

    Else

        On Error Resume Next

        Me.Bookmark = rsMe.Bookmark

        Me.Bookmark = rsMe.Bookmark

        On Error GoTo 0

    End If

    

    Me.cmdExit.SetFocus

   Me.cboVendors.Visible = False

 

End Sub

 

All I did was add the On Error line and issue the Bookmark a second time.
The second line apparently works. 

 

Can anyone help me avoid the embarrassment of having to explain to the next
programmer on this app why that code is there? Does anyone know what the
problem is and perhaps a fix?

 

I already tried recompile.  And also ran it through the decorrupter.

 

MTIA

 

 

Rocky Smolin (semi-ret.)

Beach Access Software

760-683-5777

 
<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.bchacc.com&d=DwICAg
&c=kn4_INW_mBCDHV_xJEVJkg&r=pQuzU2JPOWFA8d1LR0ScRkf41KAmO3vze52XDXdA5D1EN8y5
q3NCFsL309SJtnkO&m=r-hbS5KE6sbCpDw2bc8J-wJT_SsfrCq9ZBd-Ifmb9JY&s=TqJRBZo_vdh
B6OnSJC5dM7FmCkxTzcDfsfL35PHzJPI&e= >
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.bchacc.com&d=DwICAg&
c=kn4_INW_mBCDHV_xJEVJkg&r=pQuzU2JPOWFA8d1LR0ScRkf41KAmO3vze52XDXdA5D1EN8y5q
3NCFsL309SJtnkO&m=r-hbS5KE6sbCpDw2bc8J-wJT_SsfrCq9ZBd-Ifmb9JY&s=TqJRBZo_vdhB
6OnSJC5dM7FmCkxTzcDfsfL35PHzJPI&e= 

 
<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.e-2Dz-2Dmrp.com&d=D
wICAg&c=kn4_INW_mBCDHV_xJEVJkg&r=pQuzU2JPOWFA8d1LR0ScRkf41KAmO3vze52XDXdA5D1
EN8y5q3NCFsL309SJtnkO&m=r-hbS5KE6sbCpDw2bc8J-wJT_SsfrCq9ZBd-Ifmb9JY&s=doZLD3
I7PyoL2vEM1kJb7xOiCvSA-CoLUxeRJWXH2Dc&e= >
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.e-2Dz-2Dmrp.com&d=Dw
ICAg&c=kn4_INW_mBCDHV_xJEVJkg&r=pQuzU2JPOWFA8d1LR0ScRkf41KAmO3vze52XDXdA5D1E
N8y5q3NCFsL309SJtnkO&m=r-hbS5KE6sbCpDw2bc8J-wJT_SsfrCq9ZBd-Ifmb9JY&s=doZLD3I
7PyoL2vEM1kJb7xOiCvSA-CoLUxeRJWXH2Dc&e= 

Skype: rocky.smolin

 

 

--
AccessD mailing list
AccessD at databaseadvisors.com
https://urldefense.proofpoint.com/v2/url?u=http-3A__databaseadvisors.com_mai
lman_listinfo_accessd&d=DwICAg&c=kn4_INW_mBCDHV_xJEVJkg&r=pQuzU2JPOWFA8d1LR0
ScRkf41KAmO3vze52XDXdA5D1EN8y5q3NCFsL309SJtnkO&m=r-hbS5KE6sbCpDw2bc8J-wJT_Ss
frCq9ZBd-Ifmb9JY&s=Mt1RALyfKo5SltLzOxb_dANFfpI_kPfOTZLwDViN9UA&e=
Website:
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.databaseadvisors.com
&d=DwICAg&c=kn4_INW_mBCDHV_xJEVJkg&r=pQuzU2JPOWFA8d1LR0ScRkf41KAmO3vze52XDXd
A5D1EN8y5q3NCFsL309SJtnkO&m=r-hbS5KE6sbCpDw2bc8J-wJT_SsfrCq9ZBd-Ifmb9JY&s=Rz
MKFIG1D5hO-51ELlt4BhenYr9lw9k33E5Qg9vvA0M&e= 


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list