Mona_D


I am using the following code to use an unbound text box to display the PM Name associated with the PM Number but for whatever reason, I keep getting the Runtime Error '2001' when I run the code.

Private Sub Combo59_AfterUpdate()
Dim StrName As String
Dim strPM_Select As String
strPM_Select = "[PM Number]=" & Me![Combo59] & ""
StrName = DLookup("[Plan_Center_Name]", "Plan_Center_EPMC", strPM_Select)
Me![PM Name] = StrName

End Sub

Please help. An explanation of the error would be great or if some one can tell me what it is that I am doing wrong that would be fabulous. Thanks!





Re: Runtime Error '2001'

MS ISV Buddy Team


Per our support engineer:

As our ISV buddy only provide some code of his issue. I can not debug it.

But we can give them some suggestion. They should pay attention to the select cause of the statement.

And a document of ¡°Description of DLookup() usage, examples, and troubleshooting in Access 2000¡± http://support.microsoft.com/kb/q208786/ is some thing useful.

You can find some trouble shooting way in the document. Tips for Troubleshooting and Debugging DLookup() Expressions http://support.microsoft.com/kb/q208786/#XSLTH3303121123120121120120

If our ISV needs more suggestions, would you please ask them to provide us a demo script to reproduce the issue. Thanks.

-brenda (ISV Buddy Team)







Re: Runtime Error '2001'

Zac Schutt

i have the following code and i get this error. Please help because this is really frustrating.

The Code

Option Compare Database
Option Explicit

Private Sub command2_Click()
Dim strWhere As String

Dim lngLen As Long

Const conJetDate = "\#mm\/dd\/yyyy\#"

If Not IsNull(Me.Text0) Then
strWhere = strWhere & "([ID] = """ & Me.Text0 & """) AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then

MsgBox "No criteria", vbInformation, "Nothing to do."
Else

strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
Private Sub command3_Click()
Dim ctl As Control
For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next
Me.FilterOn = False
End Sub
Private Sub Form_BeforeInsert(Cancel As Integer)
Cancel = True
MsgBox "You cannot add new clients to the search form.", vbInformation, "Permission denied."
End Sub
Private Sub Form_Open(Cancel As Integer)
Me.Filter = "(False)"
Me.FilterOn = True
End Sub

Please Help ME






Re: Runtime Error '2001'

MS ISV Buddy Team

Hi Zac,

What versions of the OS and Access are you running What are you trying to do with this code I just need more detail in order to send it on to our support team.

Thanks,

-brenda (ISV Buddy Team)






Re: Runtime Error '2001'

Zac Schutt

Access 2002

Windows Xp Pro Sp2

And

Windows Xp Media Center Edition Sp2

(I tried both. Don't worry, no multi-booting here)





Re: Runtime Error '2001'

MS ISV Buddy Team

Hi Zac,

I had hoped to get our internal support team to assist you with this question, but the official support for Access 2002 has reached the end of its lifecycle. My recommendation is to connect with Access users and experts in one of the Access newsgroups. Here's a link to the general newsgroup, but there are others listed in the Access Database menu in the left column.

http://www.microsoft.com/office/community/en-us/default.mspx dg=microsoft.public.access&lang=en&cr=US

I'm sorry that I couldn't help you with this.

-brenda (ISV Buddy Team)






Re: Runtime Error '2001'

cobolisdead

Code Snippet
Private Sub cmdViewReport_Click()
Dim strSQL As String
Dim strQueryName As String
Dim strtranselect As String
Dim response As Variant

strQueryName = "qryCertCardOneUpdate"
strtranselect = "(Left((tblTransaction.TransType),4)) = 'CERT'"
strSQL = "SELECT tblTransaction.SSAN, tblTransaction.CERT_NO, tblTransaction.CardNo, tblTransaction.CertYear, tblTransaction.TransType, tblTransaction.PrintCard, tblCertification.LNAME, tblCertification.FNAME, tblCertification.MI, tblCertification.PRTHOME, tblCertification.PRTLOCATION, tblCertification.PRTBUSINESS, tblCertification.LOCATION, tblCertification.ADDR, tblCertification.CITY, tblCertification.ST, tblCertification.ZIP, tblCertification.STATUS, tblCertification.BUSINESS, tblCertification.BS_ADDR, tblCertification.BS_CITY, tblCertification.BS_ST, tblCertification.BS_ZIP FROM tblTransaction "
strSQL = strSQL & "INNER JOIN tblCertification ON (tblTransaction.SSAN = tblCertification.SSAN) AND (tblTransaction.CERT_NO = tblCertification.CERT_NO) "
strSQL = strSQL & "WHERE tblTransaction.CardNo Is Null AND tblTransaction.CertYear='" & Trim(Me.txtCertYear) & "' AND tblTransaction.PrintCard=No And ((tblTransaction.SSAN) = '" & [Forms]![frmContractor]![txtSSAN] & "') AND (tblCertification.STATUS='Active' Or tblCertification.STATUS='Inactive') AND " & strtranselect & " ORDER BY tblCertification.CERT_NO;"
CreateCertQuery strSQL, strQueryName
If DCount("[CERT_NO]", "qryCertCardOne") = 0 Then
response = MsgBox("No cards found for the selected certification year", 64, "Error Prompt")
Else
DoCmd.OpenReport "rptCertCardOne", acViewPreview
End If
If DCount("[CERT_NO]", "qryCertCardOneView", "[GOODCARD] = False") > 0 Then
response = MsgBox("Card will not print due to CE Shortfall. Would you like to view the certified contractor data " & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Click <Yes> to view or <No> to skip this view", vbQuestion + vbYesNo, "View Card with CE Shortfalls")
If response = vbYes Then
DoCmd.OpenForm "frmCardShortfallOne"
End If
End If
End Sub

With the following code, I keep getting a Runtime Error 2001 message. Any ideas why I am using Windows XP SP2 and I am running Access 2003.