Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 07-18-2019, 05:24 AM   #1
marlan
Newly Registered User
 
Join Date: Jan 2010
Location: Jerusalm metropolitan
Posts: 400
Thanks: 15
Thanked 35 Times in 34 Posts
marlan is on a distinguished road
'invalid argument' Error, when preforming a search (ctrl+f) in a form

Hi all you experts,

in a Acc2003 project running in a client's location in Acc2010, he searches for a value in part of a text field a main form. This value is usually copied (ctrl+c) from part of a field in one of 9 sub-forms. These sub-form have about 20K records each (not all loaded at once, but may eventually be all loaded).
Once the desired value is copied to the clipboard, the user opens the search window (ctrl+f), in attempt to find this term in part of a field in main-form.
-EDIT-
Main-form is single-form view, sub-forms are continues-form view.

When clicking on 'Find', the user *sometimes* receives an 'invalid argument' error message.

Why would this happen? what dose this mean?

PS: This is an App about running sins 2007, FE size about 14MB, BE sizes 80MB and 5MB.

PSS: App structure (FE & BEs) has bin modified on quite a large scale a few months ago.


Last edited by marlan; 07-18-2019 at 05:37 AM. Reason: additional info
marlan is offline   Reply With Quote
Old 07-18-2019, 05:55 AM   #2
The_Doc_Man
Happy Retired Curmudgeon
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 14,693
Thanks: 93
Thanked 1,703 Times in 1,576 Posts
The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold
Re: 'invalid argument' Error, when preforming a search (ctrl+f) in a form

Are we talking about using CTRL/C to copy the desired value, CTRL/F to open the form search option, and CTRL/V to then insert the search value? You used the word "term" to describe the search value and referenced "part of a field" so this sounds like a text field.

If so, I would wonder if sometimes the field might contain special punctuation that could get in the way of the search, because Access essentially has to use one of its own search features to find that value. E.g. the equivalent of a .FindFirst or .FindNext - which would be sensitive to quoting punctuation.
__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
If I have helped you, please either click the thanks or click the scales.
The_Doc_Man is offline   Reply With Quote
Old 07-18-2019, 01:54 PM   #3
marlan
Newly Registered User
 
Join Date: Jan 2010
Location: Jerusalm metropolitan
Posts: 400
Thanks: 15
Thanked 35 Times in 34 Posts
marlan is on a distinguished road
Re: 'invalid argument' Error, when preforming a search (ctrl+f) in a form

Quote:
Originally Posted by The_Doc_Man View Post
Are we talking about using CTRL/C to copy the desired value, CTRL/F to open the form search option, and CTRL/V to then insert the search value?
Yup, that simple action..

Quote:
Originally Posted by The_Doc_Man View Post
If so, I would wonder if sometimes the field might contain special punctuation that could get in the way of the search, because Access essentially has to use one of its own search features to find that value. E.g. the equivalent of a .FindFirst or .FindNext - which would be sensitive to quoting punctuation.
These errors have occurred a few times in the past few weeks, in the last occurrence both CTRL/C and CTRL/F were of words in English, written in simple Latin letters.

When occurs, the user restarts the computer

marlan is offline   Reply With Quote
Old 07-19-2019, 06:49 PM   #4
The_Doc_Man
Happy Retired Curmudgeon
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 14,693
Thanks: 93
Thanked 1,703 Times in 1,576 Posts
The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold
Re: 'invalid argument' Error, when preforming a search (ctrl+f) in a form

Are you saying that when the error occurs, it restarts the computer? Or is it that the user gets so frustrated that THEY restart the computer as a separate action?
__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
If I have helped you, please either click the thanks or click the scales.
The_Doc_Man is offline   Reply With Quote
Old 07-21-2019, 02:23 AM   #5
marlan
Newly Registered User
 
Join Date: Jan 2010
Location: Jerusalm metropolitan
Posts: 400
Thanks: 15
Thanked 35 Times in 34 Posts
marlan is on a distinguished road
Re: 'invalid argument' Error, when preforming a search (ctrl+f) in a form

I was offline for the weekend, thanks for staying tuned

Quote:
Originally Posted by The_Doc_Man View Post
Are you saying that when the error occurs, it restarts the computer? Or is it that the user gets so frustrated that THEY restart the computer as a separate action?
The user says restarting the app didn't make a difference, so HE restarted the computer, witch has made a temporary difference.

I'm wondering if it is a corruption issue, or a computer/network/network drive issue.

Does it sound like file corruption? FE file? BE File?

Thanks a lot!
marlan is offline   Reply With Quote
Old 07-21-2019, 09:03 AM   #6
The_Doc_Man
Happy Retired Curmudgeon
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 14,693
Thanks: 93
Thanked 1,703 Times in 1,576 Posts
The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold
Re: 'invalid argument' Error, when preforming a search (ctrl+f) in a form

If restarting the computer makes a temporary difference, it MIGHT be a type of corruption for which it is POSSIBLE that a manually initiated Compact & Repair might be constructive. As a precaution, if planning a C&R, you should ALWAYS make a copy of the file first, just in case the C&R goes west on you due to worse corruption than you might have thought.

However, I'm more inclined to think you have bad data somewhere that doesn't meet the technical definition of corruption (or at least, as we normally see it.)

For split database, you must perform the C&R on both files separately. If they are in fact on two different drives, it might not be a bad idea to schedule a disk scan of each drive at the next opportunity. If the BE is on a shared disk with many users, it might need to be a "scheduled, after-hours" scan.

Whatever is going on, the fact that it only occurs sometimes (even though doing the same operation each time) means it is MORE likely to be related to the BE file. But that is not 100% - more like 75/25 or 80/20.

Question: At this client's site, how many users are on the app and does each user have a private FE copy linking to a shared BE? Or is it based on some other configuration than I just described.

Question: When the user restarts the computer (and post 1 verified it is an FE/BE split), WHICH computer gets restarted that has some temporary effect? The host of the FE or the host of the BE?
__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
If I have helped you, please either click the thanks or click the scales.
The_Doc_Man is offline   Reply With Quote
Old 07-21-2019, 03:52 PM   #7
marlan
Newly Registered User
 
Join Date: Jan 2010
Location: Jerusalm metropolitan
Posts: 400
Thanks: 15
Thanked 35 Times in 34 Posts
marlan is on a distinguished road
Re: 'invalid argument' Error, when preforming a search (ctrl+f) in a form

Quote:
Originally Posted by The_Doc_Man View Post
Question: At this client's site, how many users are on the app and does each user have a private FE copy linking to a shared BE?
As for now it is 1 user, it could go up to 5 users, each having his own FE.

Quote:
Originally Posted by The_Doc_Man View Post
Question: When the user restarts the computer (and post 1 verified it is an FE/BE split), WHICH computer gets restarted that has some temporary effect? The host of the FE or the host of the BE?
Only the FE. the BE is in a network drive, part on a large office.

C&R was the first action I've done, for both FE and BE.

Let me add some more on the files structure:

1. New version of FE is distributed by putting the file in a known network location. The user runs a small local app, with copies the FE from network drive to his own c:\temp\AppName.mdb, and opens it.

2. I've added last April a small maintenance app, witch dose the C&R, and then Zips the file to be Back-uped:
Code:
Private Function CompactAndRepairFile(FileName As String) As Boolean
    Dim fs As Object, retVal As Boolean
    Dim DestFileName As String
    
    Set fs = CreateObject("Scripting.FileSystemObject")
    DestFileName = GetFileFolder(FileName) & DateToStringFormated(Now, True) & GetFileName(FileName)
    
    retVal = Application.CompactRepair(FileName, DestFileName)
    
    If retVal Then
        fs.CopyFile DestFileName, FileName, True
    End If
    
    fs.DeleteFile DestFileName
    
    CompactAndRepairFile = retVal
    
End Function
And then Zips it for backup:
Code:
Sub ZipAFile(FileName As String, Optional Destination As String = "")
    Dim strDate As String, DefPath As String, sFName As String
    Dim oApp As Object, iCtr As Long, i As Integer
    Dim FName, vArr, FileNameZip
        
    FileNameZip = IIf(Len(Destination) < Len("C:\a.zip"), RemoveFileExtention(FileName) & ".zip", Destination)
    DefPath = GetFileFolder(CStr(FileNameZip))  'Application.DefaultFilePath
    If Right(DefPath, 1) <> "\" Then
        DefPath = DefPath & "\"
    End If

    FName = FileName
    If Not FileExists(CStr(FileNameZip)) Then _
        NewZip (FileNameZip)
    Set oApp = CreateObject("Shell.Application")
    oApp.Namespace(FileNameZip).CopyHere FName
'    Do Until oApp.Namespace(FileNameZip).items.Count = i
'    i = i + 1
'        'Application.Wait (Now + TimeValue("0:00:01"))
'    Loop
    On Error GoTo 0
'        MsgBox i & vbCrLf & "You find the zipfile here: " & FileNameZip
    'End If
End Sub
Question: could this series of actions be to harsh on the file?

TIA!

marlan is offline   Reply With Quote
Old 07-21-2019, 06:50 PM   #8
The_Doc_Man
Happy Retired Curmudgeon
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 14,693
Thanks: 93
Thanked 1,703 Times in 1,576 Posts
The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold
Re: 'invalid argument' Error, when preforming a search (ctrl+f) in a form

If the CompactAndRepairFile isn't trying to C&R itself, this should be OK. However, I am a known cautious person about some things. Therefore, I would make an extra copy of the file before actually doing the Application.CompactRepair and then, IF nothing triggered a trap handler during the C&R, you can get rid of the extra copy and proceed with other disposition steps.

In your ZipAFile routine, it is of no BIG concern, but technically your variables FName, vArr, and FlieNameZip are all variants. If that is what you wanted, then fine.

The acid test of whether this sequence is or isn't harsh is whether in another folder you can unzip the file and use it. If you can't, then yes it was harsh.
__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
If I have helped you, please either click the thanks or click the scales.
The_Doc_Man is offline   Reply With Quote
Old 07-21-2019, 10:39 PM   #9
marlan
Newly Registered User
 
Join Date: Jan 2010
Location: Jerusalm metropolitan
Posts: 400
Thanks: 15
Thanked 35 Times in 34 Posts
marlan is on a distinguished road
Re: 'invalid argument' Error, when preforming a search (ctrl+f) in a form

Quote:
Originally Posted by The_Doc_Man View Post
The acid test of whether this sequence is or isn't harsh is whether in another folder you can unzip the file and use it. If you can't, then yes it was harsh.
It works fine in another folder.

I think that takes us back to the initial question: how could I detect if the 'invalid argument' Error is a computer, Network, network drive' or file error?

The next question: If it is a file error, how would I fix it? (assuming all the data is in tact, as for now I have nothing indicating otherwise...)
marlan is offline   Reply With Quote
Old 07-22-2019, 05:10 AM   #10
gemma-the-husky
Super Moderator
 
gemma-the-husky's Avatar
 
Join Date: Sep 2006
Location: UK
Posts: 13,814
Thanks: 56
Thanked 1,028 Times in 994 Posts
gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all
Re: 'invalid argument' Error, when preforming a search (ctrl+f) in a form

maybe the copied text somehow includes a non-visible control character? Would that prevent "find" working correctly?
__________________
Dave (Male!)
Gemma was my dog

if a poster helps you, please click the scales at the bottom left of this posting, or use the thanks button alongside.
gemma-the-husky is offline   Reply With Quote
Old 07-22-2019, 12:41 PM   #11
marlan
Newly Registered User
 
Join Date: Jan 2010
Location: Jerusalm metropolitan
Posts: 400
Thanks: 15
Thanked 35 Times in 34 Posts
marlan is on a distinguished road
Re: 'invalid argument' Error, when preforming a search (ctrl+f) in a form

Thanks Dave for your reply
Quote:
Originally Posted by gemma-the-husky View Post
maybe the copied text somehow includes a non-visible control character? Would that prevent "find" working correctly?
would it error, or just not find?
The data this text is copied from is imported from XML using Xpath and DAO.Recordset, or from Excel, using TransferSpreadsheet.

I assume these non-visible control characters were not imported in these processes (even though the processes and data sours were modified in the past year), and then ask myself if these may have bin added as a result of some corruption?...
marlan is offline   Reply With Quote
Old 07-22-2019, 03:22 PM   #12
The_Doc_Man
Happy Retired Curmudgeon
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 14,693
Thanks: 93
Thanked 1,703 Times in 1,576 Posts
The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold
Re: 'invalid argument' Error, when preforming a search (ctrl+f) in a form

If you are worried about code corruption, look up info on the /DECOMPILE switch to force it to get rid of all code and recompile everything. If you had corrupted code, this will get rid of it. If you had corrupted data, the C&R discussed earlier would handle that. If neither action fixes the problem, then it has to be, not corrupted data, but bad data that is legal to be copied but that interacts with the comparison process.

By any chance, does this code have an Option Compare statement? And if so, to what is it set? Is there any chance that the data source is UNICODE but the functions and database setting are Text-mode comparisons?
__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
If I have helped you, please either click the thanks or click the scales.
The_Doc_Man is offline   Reply With Quote
Old 07-22-2019, 11:09 PM   #13
marlan
Newly Registered User
 
Join Date: Jan 2010
Location: Jerusalm metropolitan
Posts: 400
Thanks: 15
Thanked 35 Times in 34 Posts
marlan is on a distinguished road
Re: 'invalid argument' Error, when preforming a search (ctrl+f) in a form

Quote:
Originally Posted by The_Doc_Man View Post
If you are worried about code corruption, look up info on the /DECOMPILE switch to force it to get rid of all code and recompile everything. If you had corrupted code, this will get rid of it. If you had corrupted data, the C&R discussed earlier would handle that. If neither action fixes the problem, then it has to be, not corrupted data, but bad data that is legal to be copied but that interacts with the comparison process.

By any chance, does this code have an Option Compare statement? And if so, to what is it set? Is there any chance that the data source is UNICODE but the functions and database setting are Text-mode comparisons?
Shamed to say, this process in not by code, but Ctrl/F Find tool built in MS Office / Access, so the Option Compare statement is not relevant.
marlan is offline   Reply With Quote
Old 07-23-2019, 12:45 PM   #14
gemma-the-husky
Super Moderator
 
gemma-the-husky's Avatar
 
Join Date: Sep 2006
Location: UK
Posts: 13,814
Thanks: 56
Thanked 1,028 Times in 994 Posts
gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all
Re: 'invalid argument' Error, when preforming a search (ctrl+f) in a form

Quote:
would it error, or just not find?
The data this text is copied from is imported from XML using Xpath and DAO.Recordset, or from Excel, using TransferSpreadsheet.
it was just a thought. I was surprised at your result, but there's no way of knowing what effect badly formed data would have. The fact that coming from an external file makes it more likely rather than less, I imagine

Equally, it might be a corruption in the field being searched, as others have noted.



Can you get your client to send you the source of what he is copying, so you can try to reproduce it, or at least inspect the source.
__________________
Dave (Male!)
Gemma was my dog

if a poster helps you, please click the scales at the bottom left of this posting, or use the thanks button alongside.
gemma-the-husky is offline   Reply With Quote
Old 07-23-2019, 07:34 PM   #15
The_Doc_Man
Happy Retired Curmudgeon
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 14,693
Thanks: 93
Thanked 1,703 Times in 1,576 Posts
The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold
Re: 'invalid argument' Error, when preforming a search (ctrl+f) in a form

Seems to me there is a "global" setting found from the File >> Options menu that allows you to setthe database comparison method. Check that.

I'm with Dave. Data coming from an external file is often less sanitized than data directly entered to Access. A "funky" but invisible character is my guess for the most likely culprit.

__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
If I have helped you, please either click the thanks or click the scales.
The_Doc_Man is offline   Reply With Quote
Reply

Tags
invalid argument

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Invalid argument with search box Sketchin Modules & VBA 1 03-25-2014 12:00 PM
Invalid Argument Error mafhobb General 10 08-05-2008 07:50 AM
'Invalid argument' error when sql run in Access VB. Val123 Modules & VBA 2 07-25-2007 07:09 AM
Invalid Argument Error Gazza111 Tables 1 11-11-2005 10:03 AM
[SOLVED] Invalid Argument - Error 3001 tdb Modules & VBA 1 11-30-2000 11:42 PM




All times are GMT -8. The time now is 12:49 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World