Solved

Run-time error '3464'

Posted on 2009-04-06
4
654 Views
Last Modified: 2013-11-05
In the attached example, form MasterBrokerAcct, "Edit" button is supposed to open another form, but it doesn't work. The sample is from Access Inside Out book. It runs fine there. Can't figure out why...
Thanks
OHTS5.mdb
0
Comment
Question by:lysenko
  • 2
4 Comments
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 300 total points
ID: 24079680


change this line

    strWhere = "[AcctNumber] IN (" & strWhere & ")"


to

    strWhere = "[AcctNumber] IN ('" & strWhere & "')"
0
 

Author Comment

by:lysenko
ID: 24079764
thanks a lot. it works. why does missing a single quote cause this problem?
0
 
LVL 28

Accepted Solution

by:
TextReport earned 200 total points
ID: 24079811
The problem is that the field you are using is a string and therefore you need the ' or " around the values. As you have the code written to use the multiselect listbox you therefore need to fix the line

        strWhere = strWhere & Me!lstBrokerAcct.Column(0, varItem) & ","

so it reads as

        strWhere = strWhere & Chr(39) & Me!lstBrokerAcct.Column(0, varItem) & Chr(39) & ","

Cheers, Andrew
0
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 300 total points
ID: 24079848
because the AcctNumber field is a Text type of data

actually this is the codes that you need to use, the first one above will fail if you choose more than one item from the listbox


Private Sub cmdSome_Click()
Dim strWhere As String, varItem As Variant
    ' Request to edit items selected in the list box
    ' If no items selected, then nothing to do
    If Me!lstBrokerAcct.ItemsSelected.Count = 0 Then Exit Sub
    ' Loop through the items selected collection
    For Each varItem In Me!lstBrokerAcct.ItemsSelected
        ' Grab the CompanyID column for each selected item

'*** this line was changed *****
        strWhere = strWhere & Chr(39) & Me!lstBrokerAcct.Column(0, varItem) & Chr(39) & ","
    Next varItem
    ' Throw away the extra comma on the "IN" string
    strWhere = Left$(strWhere, Len(strWhere) - 1)
    ' Open the invoices form filtered on the selected invoices
    strWhere = "[AcctNumber] IN (" & strWhere & ")"
    DoCmd.OpenForm FormName:="frmBrokerAcctEdit", wherecondition:=strWhere
    ' Put the focus on the form
    Forms!frmBrokerAcctEdit.SetFocus
    DoCmd.Close acForm, Me.Name
End Sub
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now