Solved

Run-time error '3464'

Posted on 2009-04-06
4
661 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) 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 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

738 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