Results 1 to 4 of 4
  1. #1
    Abacus1234 is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    212

    Query not working after importing

    Could anyone help me understand an import issue.

    After creating a small database of selected objects, and first deleting and them importing the said objects into a full database, a query did not work properly. But if I import it to another complete database, and them import from that database instead of the update database, it does work.

    That particular query references a code module that concatenates names and address, and this is the field that doesn't work when importing from the update database.

    I have in the past, had to include a table when importing queries, that was not part of what I wanted to import but seemed necessary for the query import to work.



    Thanks for any help.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    Doesn't work really doesn't help readers. Examples of input and expected output and observed output would clarify your post.
    Perhaps you could post a copy of the data and programs(database).

  3. #3
    Abacus1234 is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    212
    At the moment, the query will not open and gives me the following message: Undefined function'[CombineNamesAddresses$"] in expression. The field in the query reads like this Sellers: CombineNamesAddresses$("CloseForm","Seller") and the same field works in other queries. I have been importing the query in question frequently without any problem.

    [CODE]Function CombineName(FormName$, BaseNameEx$)

    'Combine the name fields on FormName$.BaseNameEx$ as definedfor
    'CombineNamesAddresss

    Dim TempName$

    ' If Not(IsNull(Forms(FormName$)(BaseNameEx$ + "Prefix"))) Then
    ' TempName$ = Forms(FormName$)(BaseNameEx$ +"Prefix")
    ' Else
    TempName$ =""
    ' End If

    If Not(IsNull(Forms(FormName$)(BaseNameEx$ + "FName"))) Then
    If TempName$<> "" Then TempName$ = TempName$ + " "
    TempName$ =TempName$ + Forms(FormName$)(BaseNameEx$ + "FName")
    End If

    ' If Not(IsNull(Forms(FormName$)(BaseNameEx$ + "Initials"))) Then
    ' If TempName$ <> "" ThenTempName$ = TempName$ + " "
    ' TempName$ = TempName$ +Forms(FormName$)(BaseNameEx$ + "Initials")
    ' End If

    If Not(IsNull(Forms(FormName$)(BaseNameEx$ + "LName"))) Then
    If TempName$<> "" Then TempName$ = TempName$ + " "
    TempName$ =TempName$ + Forms(FormName$)(BaseNameEx$ + "LName")
    End If

    'If Not(IsNull(Forms(FormName$)(BaseNameEx$ + "Suffix"))) Then
    ' If TempName$ <> "" ThenTempName$ = TempName$ + " "
    ' TempName$ = TempName$ +Forms(FormName$)(BaseNameEx$ + "Suffix")
    'End If

    If TempName$ ="" Then
    CombineName = Null
    Else
    CombineName =TempName$
    End If

    End Function

    Function CombineNamesAddresses$(FormName$, BaseName$)

    '
    'Combines upto 4 names and addresses with BaseName on Form$.
    'Each address is combined to a single line.
    'Names without an address are attached to the previous name.
    'Duplicate addresses (for sequential entries) are treated asname only above.
    '
    'The name consists of these fields (all prefixed withBaseName$):
    'Prefix FName Initials LName Suffix
    '
    'Likewise the address consists of:
    'Add City State Zip
    ''Add' is converted to a single line.

    Dim Name1, Name2,Name3, Name4 As Variant
    Dim Addr1, Addr2,Addr3, Addr4 As Variant
    Dim Full$


    'Build all the names
    Name1 =CombineName(FormName$, BaseName$ + "1")
    Name2 =CombineName(FormName$, BaseName$ + "2")
    Name3 =CombineName(FormName$, BaseName$ + "3")
    Name4 =CombineName(FormName$, BaseName$ + "4")

    '...and theaddresses
    Addr1 =CombineAddress(FormName$, BaseName$ + "1")
    Addr2 =CombineAddress(FormName$, BaseName$ + "2")
    Addr3 =CombineAddress(FormName$, BaseName$ + "3")
    Addr4 =CombineAddress(FormName$, BaseName$ + "4")

    'Pad out blank addresses
    If IsNull(Addr1)Then Addr1 = ""
    If IsNull(Addr2)Then Addr2 = Addr1
    If IsNull(Addr3)Then Addr3 = Addr2
    If IsNull(Addr4)Then Addr4 = Addr3

    'Combine names withthe same address
    If Not(IsNull(Name1) Or IsNull(Name2) Or IsNull(Addr1)) Then
    If (Addr2 = Addr1)Then 'Second same as first
    Name1 = Name1 +" & " + Name2
    Name2 = Null
    End If
    End If
    If Not(IsNull(Name3) Or IsNull(Name4) Or IsNull(Addr3)) Then
    If (Addr4 = Addr3)Then
    Name3 = Name3 +" & " + Name4
    Name4 = Null
    End If
    End If

    Full$ = ""
    If Not(IsNull(Name1)) Then Full$ = Name1 + ", " + Addr1
    If Not(IsNull(Name2)) Then
    If Full$ <>"" Then Full$ = Full$ + Chr(13) + Chr(10)
    Full$ = Full$ + Name2+ ", " + Addr2
    End If
    If Not(IsNull(Name3)) Then
    If Full$ <>"" Then Full$ = Full$ + Chr(13) + Chr(10)
    Full$ = Full$ +Name3 + ", " + Addr3
    End If
    If Not(IsNull(Name4)) Then
    If Full$ <>"" Then Full$ = Full$ + Chr(13) + Chr(10)
    Full$ = Full$ +Name4 + ", " + Addr4
    End If

    CombineNamesAddresses$ = Full$

    End Function
    [/CODE]

  4. #4
    Abacus1234 is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    212
    I think I have a solution: If I pull in the code module to the temporary database, and then import the 2 queries everything works.

    Is there a way of transporting objects that does not need any reference?

    I am confused as I have imported the same query before without any problems.
    Last edited by Abacus1234; 10-25-2015 at 07:43 AM.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 22
    Last Post: 01-23-2014, 09:33 AM
  2. Importing Excel Not working. Please help.
    By gbarrows in forum Import/Export Data
    Replies: 3
    Last Post: 04-05-2013, 08:13 AM
  3. Replies: 3
    Last Post: 10-17-2012, 09:24 AM
  4. Importing a query into Excel 2000
    By jo15765 in forum Queries
    Replies: 1
    Last Post: 09-21-2011, 11:14 AM
  5. Replies: 0
    Last Post: 03-27-2008, 08:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums