Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Run-time error '3464'

Posted on 2009-04-06
4
Medium Priority
?
667 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 1200 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 800 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 1200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

618 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