Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




VB Filter Error 3001 (Resolved)


I am getting an error:
Run-time error '3001'
Arguements are of the wrong type, are out of acceptable range, or are in conflict with on another.

I have tried not using between and using < and > and different veriations of the filter but keep getting the same thing.... Do anyone see anything maybe I am missing.



strFilter = "'" & rsSummaryNotes.Fields("InDate") & "' BETWEEN ' " & Format(frmCriteria.StartDate, "mm/dd/yyyy") & "' AND '" & Format(frmCriteria.EndDate, "mm/dd/yyyy") & "'"



rsSummaryNotes.filter = strFilter



Thanks,
Spafa9




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Recordset FIlter Like '%' Error 3001
Hi
I am trying to filter a recordset as follows: -
rec.Filter="FieldName Like '" & TextBox.text & "%'"


It works fine unless the string becomes like any one of following: -

Code:


rec.Filter="FieldName LIKE '_%'"
OR
rec.Filter="FieldName LIKE '%%'"



error = 3001

Waiting for someone to shed a light of hope

Run-time Error '3001' (Resolved)
Ok, I keep getting this error when I try running my code. I've done it like this numerous times and it has always worked before. For some reason it now gives me this error. Oh, and I'm using VB6 and SQL Server 2000.

The error means, "Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another".

Code:
    Public rsNewLine As New ADODB.Recordset
    Public cmdNewLine As New ADODB.Command
    
    Set cmdNewLine.ActiveConnection = conn
    cmdNewLine.CommandText = "SELECT * FROM {Table1} WHERE {Field1} = '" & Format(Text1.Text, "000") & "'"
    rsNewLine.CursorLocation = adUseClient
    rsNewLine.Open cmdAddNew, , adOpenStatic, adLockBatchOptimistic '<--- Error occurs here


Anyone have any ideas as to why this is occurring or more importantly how to fix it?



Edited by - jseal on 5/30/2006 12:37:50 PM

Error 3001
does any one recognise this error?

http://www.caesarswife.nl/error3001.jpg
I get this when I try to update a rcord from VB in a access DB using


Code:
Private Sub cmdUpdate_Click()

Dim answ As Integer
'change active record
answ = MsgBox("do you want to submit this record?", vbCritical + vbYesNo, "change records")
On Error GoTo Error 'error handler

If answ = vbYes Then
AdoChange2.Recordset.Update 'really submit the record

AdoChange2.Recordset.Bookmark = AdoChange2.Recordset.Fields
Else
AdoChange2.Refresh 'show the real record
End If
Error:
MsgBox "Error " & Err.Number & ": " & Err.Description, , "Error!!"


End Sub

thanks in advance

3001 Error Once Again
Hi to all..
this is a sample of my code but it still doesnt work

Code:
Private Sub Form_Load()
Set MyConn = New ADODB.Connection
MyConn.CursorLocation = adUseClient


MyConn.Provider = "Microsoft.Jet.OLEDB.4.0"
MyConn.properties("Data Source") = "C:Program Filesapofaseisapofaseis_db.MDB"
MyConn.properties("Jet OLEDB:Database Password") = "dadis"
MyConn.Open


Set rsaccess = New ADODB.Recordset
rsaccess.Open "select name from plim_tb ORDER BY NAME", MyConn, adOpenDynamic, adLockOptimistic
Do While Not rsaccess.EOF
Combo2.AddItem rsaccess.Fields("name")
rsaccess.MoveNext
Loop

End Sub


Private Sub Command1_Click()
If Len(Combo2.Text) = 0 Then
MsgBox " /"


Exit Sub
Else




Set rsaccess = New ADODB.Recordset
rsaccess.Open "select serial from plim_tb where name='" & Combo2.Text & " ' ", MyConn, adOpenDynamic, adLockOptimistic

End If
End Sub
i get a 3001 run time error ... i cant find the reason....

Another Error 3001
Couldn't find my answers anywhere...

I have this code:


Code:
Dim dbS as Connection
Dim rsWordies As Recordset
[indent]Set dbS = New Connection
dbS.CursorLocation = adUseClient
openStatement = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & spellDic & ";"
dbS.Open openStatement
DoEvents

Set rsWordies = New Recordset
mySQL = "SELECT Word FROM Words WHERE Word = " & Chr(34) & Word & Chr(34)
[b]rsWordies.Open dbS, mySQL, adOpenStatic, adLockReadOnly[/b]

If rsWordies.RecordCount = 0 Then[indent]'Do Stuff[/indent]End IF[/indent]

Every time it hits the "rsWordies.Open dbS, mySQL, adOpenStatic, adLockReadOnly" it gives me the "Error 3001, Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another"

anyone know why? I couldn't find a straight answer on here

edit: btw.. the line in bold is where the error is occuring.. not sure why, since it does that same line with different database and sql statement HUNDREDS of times in the program!!!

Error 3001
Hi!

I have information in my tables from where i need to transfer the data to a text file. There is a text field column that needs to be ported. I use getchunk method to transfer the data.
this works fine for any set of data that I have. There is one particular time that i get a run time error
3001 which says Arguments are of the wrong type, are out of acceptable range, or are in conflict with each other.

If i create a new table with the same column details and put this errorring record alone into it, it works fine.

Also if i delete that erroring record from the table and try to run the same export function, it errors in the previous record with the same error.
What could be the problem.
Please help

ADO Error 3001
   
Search on Google and on this Forum did not help, so here it is....

I am trying to Filter my ADODB recordset:
CODEstrSQL = "SELECT MYITEM.PSQTY_ITEM_ICDE1, MYITEM.PSQTY_CATEGORY_KEY, " _
    & " MYITEM.PSQTY_PROJECTNUMBER, MYITEM.PSQTY_ITEM_NO, " _
    & " MYITEM.PSQTY_DESIGN_QUANTITY, MYITEM.PSQTY_ITEM_SUPPLEMENT1, " _
    & " MYITEM.PSQTY_ITEM_SUPPLEMENT2, MYITEM.PSQTY_ITEM_SUPPLEMENT3 " _
    & " FROM S4111000.PSITEM_QUANTITIES MYITEM, S4111000.PSLET_INFORMATION MYLET " _
    & " WHERE MYITEM.PSQTY_PROJECTID = MYLET.PSLET_PROJECTID " _
    & " AND MYITEM.PSQTY_PROJECTNUMBER = MYLET.PSLET_PROJECTNUMBER " _
    & " AND (MYLET.PSLET_CONTRACTLETDATE = TO_DATE('" & LET_DATE & "', 'MM/DD/YYYY')) " _
    & " AND (MYITEM.PSQTY_ITEM_ICDE1 IS NOT NULL)"

recOne.Open strSQL, Cn

recOne.Filter = " (PSQTY_ITEM_SUPPLEMENT1 = '" & strSupl1 & "') " _
& " AND (PSQTY_ITEM_SUPPLEMENT2 IS NULL) " _
& " AND (PSQTY_ITEM_SUPPLEMENT3 IS NULL)"

Run Time Error 3001
im recieving run time error 3001... arguments are of the wrong type, are outof acceptable range or are in conflict with on another
----------------------------------
it highlights this code when i debug... have no idea why

'**Add a blank record to the Recordset
.AddNew Array("CustomerNumber", "Surname", "FirstName", "Street", _
"Suburb", "PostCode", "Phone", "State", "Email"), _
Array(txtCustomerNumber.Text, txtSurname.Text, txtFirstName.Text, _
txtStreet.Text, txtSuburb.Text, txtPostCode.Text, _
txtPhone.Text, txtState.Text, txtEmail.Text, False)
----------------------------------

Here is the whole Event where the particular code comes from

Private Sub cmdsave_Click()
Dim PinResponse As Integer
Dim pstMsg As String
Dim pinButtons As Integer
Dim pstFindCriteria As String
Dim pLngCustomerNumber As Long

Dim pboNoEntry As Boolean

pboNoEntry = noentry 'this calls the function
If pboNoEntry = False Then
With mrsCustomers
If mstMode = "Add" Then
'**Add a blank record to the Recordset
.AddNew Array("CustomerNumber", "Surname", "FirstName", "Street", _
"Suburb", "PostCode", "Phone", "State", "Email"), _
Array(txtCustomerNumber.Text, txtSurname.Text, txtFirstName.Text, _
txtStreet.Text, txtSuburb.Text, txtPostCode.Text, _
txtPhone.Text, txtState.Text, txtEmail.Text, False)

pstMsg = "The added event has been saved. Do you want to add another one?"
pinButtons = 10

ElseIf mstMode = "Edit" Then
pstMsg = "The change record has been saved."
pinButtons = 5
'**Move to the recordpointer to the record being edited, ie last name
pstFindCriteria = "Surname = '" & mstSurname & "'"
.MoveFirst
.Find pstFindCriteria

End If
End With

'**Tell the user that the record has been saved and if in Add Mode ask he/she wants to add another.
PinResponse = MsgBox(pstMsg, vbYesNo, "Record Saved")
If PinResponse = vbYes Then
Call cmdAdd_Click
Exit Sub
Else
'**This code applies to a No response in Add mode and also to the Okay response in Edit mode.
'** Set the form into View Mode again.
Call SetInactiveTextBoxes
lblHeading.Caption = "Event"
mstMode = "View"
'**reseting the recordpointer to the new/changed record.
mrsCustomers.Find "Surname = '" & txtSurname.Text & "'"
End If
Else
Exit Sub 'do nothing
End If

errorstop:
MsgBox "An Error occured." & Err.Number & " " & Err.Description
Exit Sub
Resume Next
End Sub

----------
Thanks for your help

Error '3001' W/ Access DB
I am trying to extract data from some tables in an Access DB. I have never worked with databases before but gave it my best shot after looking here. Here is my code:


Code:
Dim cn As Connection
Dim rstTableNames As Recordset
Dim rstPSupport As Recordset
Dim strDBpath As String
Dim strParFile As String
Dim strSchemaName As String
Dim icounter As Integer
Dim strFile As String
Dim arrCoords() As String
Dim strCoords As String
Dim arrSchemaName() As String

strParFile = frmOptions.Text1.Text & "psupp.par"
icounter = 0
If FileExists(strParFile) = True Then
Open strParFile For Input As #74
Do Until icounter = 3
Input #74, strSchemaName
icounter = icounter + 1
Loop
arrSchemaName = Split(strSchemaName, " ")
strDBpath = frmGetfiles.dirDirectory.Path & "" & arrSchemaName(0) & ".mdb"
Close #74
If FileExists(strDBpath) = True Then

strFile = frmGetfiles.dirDirectory.Path & "logPSupport.txt"
Open strFile For Output As #70
Set cn = New ADODB.Connection
cn.Provider = "Microsoft.JET.OLEDB.4.0"
cn.ConnectionString = strDBpath
cn.Open

Set rstTableNames = cn.OpenRecordset("tModel") 'ERROR 3001
Do Until rstTableNames.EOF
Set rstPSupport = cn.OpenRecordset("tSupports_" & rstTableNames(0))

strCoords = rstPSupport(9)
arrCoords = Split(strCoords, ",")

Print #70, "Tag ID: " & rstPSupport(1)
Print #70, "X Coord: " & arrCoords(0)
Print #70, "Y Coord: " & arrCoords(1)
Print #70, "Z Coord: " & arrCoords(2)
Print #70, ""

rstTableNames.MoveNext
Loop
cn.Close
Close #70

End If
End If

Am I trying to connect to the table wrong? I get an error on the line that I specified in the code. I need to get into table "tModel" and the first column in every record is the name of other tables. I need to get this feild so that I can open up these other tables. In the other tables I need to get the 2nd and 8th column and place this data in an ascii file.

Any help would be greatly appreciated.

Run Time Error 3001
Has anyone gotten this error before when trying to navigate through a recordset using ADO?

run-time error 3001: arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

I get this when I use my navigation buttons to try and go through the records.
It says on the website :

"This functionality cannot be accomplished with current versions of ADO.
The criteria syntax of the ADO Filter property is defined as follows:
" FieldName Operator 'Literal_Value' "
The 'Literal_Value' data type could be string, number, or date. You
cannot use the preceding expression to compare two fields. Attempting
to do so raises error 3001."

Since it is coming from when i want to go through my records that are satisfied by my query, my query must be causing it (ADO connection):

---------------------------------------------------------------------------------------------
varStatnum = Station.txtStatnum.Text
strSQL = "select AMOUNT, CLASTS, COLOUR_FRESH, COLOUR_WEATH, COMMENTS, GRAINSIZE, MAPUNIT, ROCKNUM, ROCKTYPE, STATNUM, STRUCTURE_MOD1, SUBMAPUNIT, SUBSUBTYPE, SUBTYPE, TEXTURE_MOD1, TYPE from LITHOLOGY_TABLE where STATNUM = '" & varStatnum & "' Order by ROCKNUM"
--------------------------------------------------------------------------

Runtime Error 3001
Hi,

I am facing runtime error 3001: Arguments are of the wrongtype, out of acceptable range, or are in conflict with one anohter , for this line..

sstr = "St Albans"
clientdb.Open "SELECT * FROM dist_details where dist_name = ' " & sstr & "' ", cnnopen, adOpenKeyset, adLockOptimistic
Any suggestions?

P.V.Velan

Runtime Error '3001':
Hi,
I have just joined this forum and it has come very much recomended among other more experienced VB programmers. Im currently doing a project which involves a user typing keywords into a text box and being returned with all records in a table which contain these keywords. Im using the filter property in order to filter the table down to all records containing only these keywords. The code goes as follows...
_________________________________________________________________
items() = Split(kString)

For i = LBound(items) To UBound(items)

If i = UBound(items) Then

strSQL = strSQL & "(projTitle LIKE '*" & items(i) & "*' OR projSummary LIKE '*" & items(i) & "*') "

Else

strSQL = strSQL & "(projTitle LIKE '*" & items(i) & "*' OR projSummary LIKE '*" & items(i) & "*') AND "

End If

Next i

propSearchForm.propSearchDC.Recordset.Filter = strSQL
_________________________________________________________________

Im using a 'for' loop in order to create an SQL statement that matches the number of keywords that are entered by the user. 'kString' above is the overall string entered by the user. This is split into its different keywords. Im also using ado controls in order to connect to the database.
The problem only arises when more than one keyword is entered by the user as when only one keyword is entered the next form loads up displaying the correct results. If two or more keywords is entered this error is displayed...

Runtime error '3001':

followed by...

"The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another."

What i cant understand is why it would work for one keyword and not more?? I display the SQL in a msgbox while running and it appears to look correct? Any ideas anyone...for this has me stuck for quite sometime? Thanks in advance for any help!

ADO Error 3001 - I Know Why But I'm Unsure How To Fix It
Hi all,


I'm using the ADO Find method to search an open recordset. my code all works perfectly until I try to find a string which contains ' (single quote). When I try to search for a string my app crashes with Error 3001 - Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

As far as I know this is because the ' is one of those special characters and thats what is causing the Find method to fail, but I'm not sure how to go about fixing this. I'm not sure if I can use escape characters in the Find method when I'm passing the string in as label1.caption, I don't think I can.

The other way around it is to do a little string manipulation before the record containg the ' gets written to the database in the first place i.e Remove any occurance of ' I might have a few grammatical errors but thats ok. My problem with this is that I'm pants with string manipulation

So does anyone have any ideas on how I can resolve this, or does anyone know a good tutorial on string manipulation (I need to learn sometime I suppose )


Thanks in advance


Paul Moore

Run-time Error 3001
Adodc1.Recordset.SORT = "non riconosciute"

ADODC1 property is:
AdUseClient
AdOpenStatic
AdLockOptimistic
AdCmdTable

The Field of Query is: non riconosciute: [num_totale]+[tot_riconosciute]

err.Description: The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.
err.Number: 3001

WHI ?????

BEST BON JOVI SITE:
http://www.mso.it/public/bonjovinext100years

Run-time Error '3001'
I have an vb6 application with install in single machine and contain same web application version build with vs2003.net
when i register the business component to COM+, error message
Run-time error '3001' Arguments are of the wrong type, are out of acceptable range, or conflict with one another.

any suggestion here?

code
'VPDal5 is the component i have register
Public goVpDal As VPDal5.VpDataWrap
dta As ADODB.Recordset
...
...
Call goVpDal.RsOpenReadWrite(dta, strSQL) 'error occur here
...
...

Any help would be appreciate

Getting Runtime Error '3001' Please HELP ! ! !
Hello everyone,

I am getting this runtime error '3001' whenever I run the following piece of
code and give an input of S1 or S2 in the code text box. Although there is
no error on all-numeric inputs like 01,02..etc.

It says " Arguments are of wrong type, are out of range, or are in conflict
with one another".

In the data table, the code field is text, with maximum length of 10
characters.

Please help me!! Its very urgent that I solve this problem.



With DE1.rscmdSelectCodes

If .State = adStateOpen Then
.Close
End If

With DE1.Commands("cmdSelectCodes")
.Parameters("prmLookUpNum") = txtRollNum.Text
.Parameters("prmSequence") = Val(txtFrmSeq.Text)
End With

DE1.cmdSelectCodes txtRollNum.Text, txtFrmSeq.Text

pkg = ""

bFound = False
If Not .BOF Then
.MoveFirst
End If

If Not (.RecordCount = 0) Then

.Find (Trim("code=") + txtCode.Text + "Pkg"), 0,
adSearchForward, 0

If Not .EOF Then
.Fields("quantity") = .Fields("quantity") + 1
.Update
Else
.AddNew
.Fields("lookupnum").Value = txtRollNum.Text
.Fields("sequence").Value = txtFrmSeq.Text
.Fields("code").Value = txtCode.Text + "Pkg"
.Fields("quantity").Value = 1
.Update
End If

Else
.AddNew
.Fields("lookupnum").Value = txtRollNum.Text
.Fields("sequence").Value = txtFrmSeq.Text
.Fields("code").Value = txtCode.Text + "Pkg"
.Fields("quantity").Value = 1
.Update

End If

End With

Runtime Error 3001
Hi,

I have another problem with ADO vb 6

The problem is I try to connect the Ms Access Database using ADO.
The code I use is

when I reach rsqt.Open sqlqt, 1, 2 it says
Runtime error 3001 - Arguments are of the wrong type, are out of acceptble range or are in conflict with one another.

When I use the SQl in MS access, it works fine. What is the problem from the following code.


Private Sub Qrtbrkdown_Click()
Dim qrt1, bud As String
Dim k, amt As Integer
Dim rs, rs1, rsq1, rsq2t, rsqit1, rsqt As New ADODB.Recordset
Dim sqlqt, sqlq2t, sqlqit, sqlqit1 As String

Quarter.Visible = True
qrt1 = InputBox("Which year do you want allocate quarterly?", "Year")

Label7.Caption = qrt1 ' Year

Set conn = New ADODB.Connection
conn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:moa databasefao_projectdb.mdb;Persist Security Info=False")
Set rsqt = CreateObject("adodb.recordset")


conn.BeginTrans
sqlqt = "select amount from temp_ann where yr= '" & qrt1 & "' and prjid = '" & prjNo.Text & "'"
conn.Execute sqlqt
rsqt.Open sqlqt, 1, 2

conn.CommitTrans


Label9.Caption = 200 ' Annual Budget

Set rsq2t = CreateObject("adodb.recordset")

conn.BeginTrans
sqlq2t = "select budallid, amount from temp_ann where yr= '" & qrt1 & "' and prjid = '" & prjNo.Text & "'"
rsq2t.Open sqlq2t, 1, 2
conn.CommitTrans

bud = rsq2t.Fields(0)

For k = 1 To 4
qurtamt(k) = InputBox("Amount for Quarter " & k & ",", "Quarter")
Next k

conn.BeginTrans
sqlqit = "insert into temp_Qur_Bud(budallid,quarter,amount) values('" & bud & "','" & qur(k) & "'," & qurtamt(k) & ")"
rsqt.Open sqlqit, 1, 2

conn.CommitTrans

sqlqit1 = "select * from temp_ann where prjid = '" & prjNo.Text & "'"
rsqt.Open sqlqit1, conn, 1, 2

Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:moa databasefao_projectdb.mdb;Persist Security Info=False"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sqlqit1
Adodc1.Refresh
Set budgetbrk.DataSource = Adodc1
qrtbudget.Visible = True
rsqt.close

End Sub

Thank u

Runtime Error 3001
ok new to all this but when I goto run my program I keep getting a runtime error '3001'

below is my code

Private Sub Form_Load()
    '**** Connect to database
    Dim strConnection As String
    Dim path As String
    path = App.path & "Database.mdb"
    
    '**** Set path for location of database
    strConnection = "driver={Microsoft Access Driver (*.mdb)};dbq=" & App.path & "DataDatabase.mdb" & ";uidpwd"
    
    Set conDB = New ADODB.Connection
    conDB.Open strConnection

    '**** Set all new recordsets
    Set rstEquipment = New ADODB.Recordset
    Set rstVehicleData = New ADODB.Recordset
    Set rstVehicleMiles = New ADODB.Recordset
    Set rstWorkOrder = New ADODB.Recordset
    Set rstParts = New ADODB.Recordset
    Set rstPartsHistory = New ADODB.Recordset
    Set rstPO = New ADODB.Recordset
    Set rstVendors = New ADODB.Recordset
    Set rstLabor = New ADODB.Recordset
    Set rstOfficeEquipment = New ADODB.Recordset
    Set rstBuildingEquipment = New ADODB.Recordset
    Set rstUser = New ADODB.Recordset
    
    
End Sub


Private Sub cmdEnter_Click()
    '**** stop blank entry
    If txtUserName = "" Then
        Prompt$ = "You have to enter your login name"
        reply = MsgBox(Prompt$, 48, "Blank Login Name")
        txtUserName.SetFocus
    
    '**** SET BACK DOOR
    ElseIf txtUserName.Text = "6783" Then
        User = "BackDoor"
        Password = 496
        UserLevel = "Admin"
        AccessLevel = 1
        Timer1.Enabled = True
   
    Else
        '**** set user name
        User = txtUserName.Text
        
       'Check whether user exist in the database
       rstUser.Open "SELECT * FROM User WHERE User.LoginName ='" & User & "'", conDB, adOpenStatic, adLockReadOnly"
   
       If Not rstUser.EOF Then
          
            'Check whether password is correct
           If (Password = rstUser!UserPassword) Then
               'Assign user level to global variable
               UserLevel = rstUser!UserLevel
               AccessLevel = 1
               Timer1.Enabled = True
           Else
               
               MsgBox "Logged on failed - Invalid Password", vbCritical, "Login"
           End If
       Else
           MsgBox "Logged on failed - Invalid User", vbCritical, "Login"
                       
       End If
   
   End If
End Sub


any help would be great thanks


Error 3001 In VB6 (Using RS.Find)
Have this form which i found in a project on the net. Works perfect. Its a search form which has a combo which is populate with the fields from database and a textbox where the search text is entered. It works except for a slight problem. Say if search for a word called "man" from the field title, the form shows on a datagrid the arrow which matches the record. But if i search for a text like "Tall man" , i get the error :

3001
arguments are of the wrong type, are out of acceptable range, or are in conflict with one another

Its only if i put a space between the two words the problem arises, a single word or two combined words are fine. But i do need the space. Below is the enitre form code:-

Code:
-----------------------------------------

Option Explicit
'----------------------------------------------------------------------
'Search Form
'This reusable form can be called from anywhere to search a recordset
'according to given criteria and then move the absolute position of the
'record. Includes error trapping to search in different data type
'formats.
'This code has been reused from the master forms and the Selection
'Dialog Box (frmSelectDg)-> This form has a datagrid connected to the recordset
'----------------------------------------------------------------------

Public SourceRs As ADODB.RecordSet
Private AlreadyFilled As Boolean
Private AlreadySearched As Boolean
Private CurrPos As Long
Private oldpos As Long

Private Sub Combo1_KeyPress(Keyascii As Integer)

    Keyascii = 0

End Sub

Private Sub Command1_Click()

    On Error GoTo Err
    If Text1.Text = "" Then Text1.SetFocus: Exit Sub
    If Combo1.Text = "" Then Combo1.SetFocus: Exit Sub
    With SourceRs
        If AlreadySearched = False Then
            oldpos = .AbsolutePosition
            .MoveFirst
      .Find "[" & Combo1.Text & "] like *" & Trim(Text1.Text) & "*"
             CurrPos = .AbsolutePosition
            If .EOF Then
                AttBox "Could not find '" & Text1.Text & "' in '" & Combo1.Text & "'.", attOKonly
                .AbsolutePosition = oldpos
            Else
                AlreadySearched = True
                Command1.Caption = "Search Next"
            End If
        Else
            oldpos = .AbsolutePosition
            .MoveNext
            .Find "[" & Combo1.Text & "] like *" & Trim(Text1.Text) & "*"
            CurrPos = .AbsolutePosition
            If .EOF Then MsgBox "Search completed.", vbInformation: AlreadySearched = False: .AbsolutePosition = oldpos
        End If
    End With

Exit Sub

Err:
    If Err.Number = -2147217881 Then Search_Number: Resume Next
    If Err.Number = 3265 Then AttBox "Please select a valid section from the list", attOKonly: HighLight Text1: Exit Sub
    Handler Err

End Sub

Private Sub Search_Number()

'For Number data type

    On Error GoTo Err
    SourceRs.Find "[" & Combo1.Text & "] like " & Trim(Text1.Text) & ""

Exit Sub

Err:
    Search_DateTime

End Sub

Private Sub Search_DateTime()

'For Date/Time data type

    On Error GoTo Err
    SourceRs.Find "[" & Combo1.Text & "] like #" & Trim(Text1.Text) & "#"

Exit Sub

Err:
    AttBox "Please enter an appropriate value that correspand" & vbCrLf & "where to find it (ex.Search for 10/23/1985 and Look in Date).", attOKonly

End Sub

Private Sub Command2_Click()

    Unload Me

End Sub

Private Sub Form_Load()

    FillCombo Combo1, SourceRs, False
' Me.Icon = Image1.Picture
    Combo1.ListIndex = 0

End Sub

Private Sub Text1_Change()

    AlreadySearched = False

End Sub

Public Sub Handler(Error As ErrObject)

'Shows msgbox for unhandled errors only when error has truly occured,
'i.e. err<>0

    If Error.Number <> 0 Then
        MsgBox "Error Number: " & Error.Number & vbNewLine & Error.Description, vbExclamation, "Unexpected Error"
    End If

End Sub


The part in bold is the main Sql query and my doubt there is something worng here!
The part underline is the even handler giving the error 3001.

Please Guys need help here.

Thanks
Sheldon





Edited by - Geof on 6/17/2007 3:33:35 PM

Runtime Error '3001'
I have A VB application, using access 2000 DB.
While Dveloping the App. I have no errors.
After installing the application I have runtime error 3001.
this error is very weird, it comes few days after the program is running.
Can someone help me???

Runtime Error 3001
Hi,

I have another problem with ADO vb 6

The problem is I try to connect the Ms Access Database using ADO.
The code I use is

when I reach rsqt.Open sqlqt, 1, 2 it says
Runtime error 3001 - Arguments are of the wrong type, are out of acceptble range or are in conflict with one another.

When I use the SQl in MS access, it works fine. What is the problem from the following code.


Private Sub Qrtbrkdown_Click()
Dim qrt1, bud As String
Dim k, amt As Integer
Dim rs, rs1, rsq1, rsq2t, rsqit1, rsqt As New ADODB.Recordset
Dim sqlqt, sqlq2t, sqlqit, sqlqit1 As String

Quarter.Visible = True
qrt1 = InputBox("Which year do you want allocate quarterly?", "Year")

Label7.Caption = qrt1 ' Year

Set conn = New ADODB.Connection
conn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:moa databasefao_projectdb.mdb;Persist Security Info=False")
Set rsqt = CreateObject("adodb.recordset")


conn.BeginTrans
   sqlqt = "select amount from temp_ann where yr= '" & qrt1 & "' and prjid = '" & prjNo.Text & "'"
   conn.Execute sqlqt
   rsqt.Open sqlqt, 1, 2

conn.CommitTrans


Label9.Caption = 200 ' Annual Budget

Set rsq2t = CreateObject("adodb.recordset")

    conn.BeginTrans
        sqlq2t = "select budallid, amount from temp_ann where yr= '" & qrt1 & "' and prjid = '" & prjNo.Text & "'"
        rsq2t.Open sqlq2t, 1, 2
    conn.CommitTrans

bud = rsq2t.Fields(0)

For k = 1 To 4
qurtamt(k) = InputBox("Amount for Quarter " & k & ",", "Quarter")
Next k

conn.BeginTrans
sqlqit = "insert into temp_Qur_Bud(budallid,quarter,amount) values('" & bud & "','" & qur(k) & "'," & qurtamt(k) & ")"
rsqt.Open sqlqit, 1, 2

conn.CommitTrans

sqlqit1 = "select * from temp_ann where prjid = '" & prjNo.Text & "'"
rsqt.Open sqlqit1, conn, 1, 2

Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:moa databasefao_projectdb.mdb;Persist Security Info=False"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sqlqit1
Adodc1.Refresh
Set budgetbrk.DataSource = Adodc1
qrtbudget.Visible = True
rsqt.close

End Sub

Thank u

Title: Error 3001 Using COUNT && SUM
Greeting: Using VB6, ADo 2.7, Access 2000

I'm getting the following:

Error: 3001;
Source: ADODB.Recordset;
Description: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another."

Using the following code:


Code:
strtoday = Format(Now, "mm/dd/yyyy")

RsSelection = "SELECT" _
& " count(IncomeDateTime), sum(IncomeReceived) as TotalIncome " _
& " from Income where" _
& " Format(IncomeDateTime, ""mm/dd/yyyy"") = " & Format(strtoday, "mm/dd/yyyy") & " Group By IncomeDateTime, TotalIncome "

IncomeReceived is a currency field and IncomeDateTime is a datetime field.

Can someone shed some light?

Thanks for your responses
Donald

Runtime Error 3001 (not Resol)
Hi,

I am facing runtime error 3001: Arguments are of the wrongtype, out of acceptable range, or are in conflict with one anohter , for this line..

sstr = "St Albans"
clientdb.Open "SELECT * FROM dist_details where dist_name = ' " & sstr & "' ", cnnopen, adOpenKeyset, adLockOptimistic

Any suggestions?

P.V.Velan








Edited by - vadivelan_vbcity on 8/6/2004 1:15:09 AM

Please Help Me!.... Runtime Error 3001 In Vb6 And Oracle 8i
I've some problems with my vb6 and oracle, it keep showing "runtime error 3001". below is my code can anyone here pls help me to solve it.. thanks

== This is my connection function ==
Private IsConnect As Boolean
Private Connect_Num As Integer
Private cnn As ADODB.Connection
Private rs As ADODB.Recordset


Private Sub Connect()
  If IsConnect = True Then
    Exit Sub
  End If
  
  Set cnn = New ADODB.Connection
  
  cnn.ConnectionString = "DSN=" + DSN + ";UID=" + DB_USER_NAME _
                          + ";PWD=" + DB_PASSWORD + ";"

  cnn.Open
  If cnn.State <> adStateOpen Then
    MsgBox "Database Connection Failed"
    End
  End If

  IsConnect = True
End Sub


Private Sub Disconnect()
  Dim Rc As Long
  If IsConnect = False Then
    Exit Sub
  End If
  cnn.Close
  Set cnn = Nothing
  IsConnect = False
End Sub


Public Sub DB_Connect()
  Connect_Num = Connect_Num + 1
  Connect
End Sub
Public Sub DB_Disconnect()
  If Connect_Num >= CONNECT_LOOP_MAX Then
    Connect_Num = 0
    Disconnect
  End If
End Sub

Public Sub DBapi_Disconnect()
  Connect_Num = 0
  Disconnect
End Sub


Public Sub SQLExt(ByVal TmpSQLstmt As String)
  Dim cmd As New ADODB.Command
  DB_Connect
  Set cmd.ActiveConnection = cnn
  cmd.CommandText = TmpSQLstmt
  cmd.Execute
  Set cmd = Nothing
  DB_Disconnect
End Sub


Public Function QueryExt(ByVal TmpSQLstmt As String) As ADODB.Recordset
  Dim rst As New ADODB.Recordset
  DB_Connect
  Set rst.ActiveConnection = cnn
  rst.CursorType = adOpenDynamic
  rst.LockType = adLockOptimistic
  rst.Open TmpSQLstmt
  Set QueryExt = rst
End Function







Edited by - ilike3000 on 7/2/2005 1:10:34 PM

Run-time Error '3001' During Debug ONLY
Please help me to resolve the problem.

Run-time error 3001 occurs ONLY during the debug of server-site
ActiveX DLL.

Is something wrong with my code? Error occurs on cmd.ActiveConnection
= mvarConnection line.

The following is Visual Basic code (I am using VB 6.0).
--------------------------------------------------------------------------------

Private mvarErrMsg As String 'local copy
Private mvarPassword As String 'local copy
Private mvarUserName As String 'local copy
Private mvarConnection As ADODB.Connection 'local copy
Private mvarScriptingContext As ASPTypeLibrary.ScriptingContext 'local
copy
Public Sub OnStartPage(objScriptingContext As Object)
Set mvarScriptingContext = objScriptingContext
mvarPassword = mvarScriptingContext.Request.Form("USER_PASSWORD")
mvarUserName = mvarScriptingContext.Request.Form("USER_ID")
mvarScriptingContext.Session.Contents.Item("custid") = mvarUserName
Set mvarConnection =
mvarScriptingContext.Session.StaticObjects("objConn")
End Sub
Public Function IsNewPage() As Boolean
IsNewPage = (mvarUserName = "" And mvarPassword = "")
End Function

Public Function Authenticate() As Boolean
Dim cmd As ADODB.Command
Dim parm1, parm2 As ADODB.Parameter
Dim rs As ADODB.Recordset
Err.Clear

Authenticate = False
On Error GoTo Err
Set rs = New ADODB.Recordset
Set cmd = New ADODB.Command
cmd.CommandText = "AuthenticateCustomerReseller"
cmd.CommandType = adCmdStoredProc
Set parm1 = cmd.CreateParameter("val1", adBSTR, adParamInput)
Set parm2 = cmd.CreateParameter("val2", adBSTR, adParamInput)
parm1.Value = mvarUserName
parm2.Value = mvarPassword
cmd.Parameters.Append parm1
cmd.Parameters.Append parm2
cmd.ActiveConnection = mvarConnection
Set rs = cmd.Execute
If Not rs.BOF Then
Authenticate = True
Else
mvarErrMsg = "Authentication failed"
End If

Set cmd = Nothing
Set parm1 = Nothing
Set parm2 = Nothing
Set rs = Nothing
Err:
Dim Msg
' If an error occurs, construct an error message
If Err.Number &lt;&gt; 0 Then
Msg = "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Err.Description & _
" in CRlogon.Authenticate"
mvarScriptingContext.Response.Write Msg
End If
End Function

Run Time Error 2417217900(80040e14) && 3001
I am getting a run time error on my line of code when I find(search though records ) on a specific search
The error is : run time error 2417217900(80040e14)
Syntax error (missing operator) in query expression Description=operators current stats.

It does this anytime I run the code with anything in the description or any field with an (apostrophe) or # (number sign) in the field it error on it
I can find each next record that has the search criteria without or # in any of the fields.

===I also get another error : run time error 3001: arguments are of the wrong type , are out of accesptable range , or are in conflict with one another.
It shows that operators current status(anthing with in it or # in the field)


MyRecSet.Find "[Name] = '" & Text4.Text & "'", , adSearchForward, adBookmarkCurrent

----also I need to have the search (find) able to do these functions and im sure how to do this in visual basic6
--less than (<)
less than or equal (<=)
wild card (*)


Can someone help me on this thanks

Private Sub CmdFind_Click()find button
Set Myconn = New ADODB.Connection
Myconn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:mydatabase.mdb;"
Myconn.open
Myconn.BeginTrans
Myconn.CommitTrans
Dim SQL As String
Dim StringSQL As String

SQL = "SELECT * FROM Table WHERE Description= '" & Text2.Text & "'"


Set MyRecSet = New ADODB.Recordset
MyRecSet.open SQL, Myconn, adOpenKeyset, adLockPessimistic, adCmdTextit stops here

If Not MyRecSet.EOF = 0 Then
MsgBox "no more found"
MyRecSet.Close
Set MyRecSet = Nothing
Exit Sub
End If

If Not MyRecSet.EOF And Not MyRecSet.BOF Then

MyRecSet.MoveNext

MyRecSet.Find "[Number] = '" & Text3.Text & "'", , adSearchForward, adBookmarkCurrent
MyRecSet.Find "[Name] = '" & Text4.Text & "'", , adSearchForward, adBookmarkCurrent
MyRecSet.Find "[Description] = '" & Text5.Text & "'", , adSearchForward, adBookmarkCurrent

MyRecSet.MoveNext 'was .movefirst
If Not MyRecSet.EOF = 0 Then
MsgBox "no more found"
MyRecSet.Close
Set MyRecSet = Nothing
Exit Sub
End If

Text3.Text = MyRecSet.Fields("Number").Value
Text4.Text = MyRecSet.Fields("Name").Value
Text5.Text = MyRecSet.Fields("Description").Value
Else

MyRecSet.MoveLast

MsgBox "all found!!!"

End If
End Sub

Select @@identity Gives 'error 3001' ?!? Any Idea ?
Hi there,

Got a 'ordinary' problem.... Using Sql2000 and VB6...

Try to insert a line into a table and get id of the last inserted... I've read the other threads dealing with the problem but cannot find a way out...

Sample of my code :

SQL = "insert into MediaFile (FileName) values ('Blah Blah') SELECT @@IDENTITY"
Cmd.CommandText = SQL
Set rsMD = New ADODB.Recordset
rsMD.Open Cmd.Execute
IdMedia = rsMD.NextRecordset.fields(0)

The application crashes on the open command with the message ' RT Error 3001 : Argument type not correct, outside of limits or conflicting with each other' (Sorry : free transaltion from french message )

If I copy-patse the same code in the sql query analyser, it gives me the last id in return...

Do you have any idea, I'm a little lost...
Oups : have to be more precise, I cannot use Stored Proc in this particular database (because with SP it works fine, of course)..

TIA for your reply

Error: 3001 In Trying To Open A Query With Parameter...
Hello!
I've a problem in trying to open a query in an access module
that's my simple code....
Code:
Set qdf = CurrentDb.QueryDefs(nomeSql)
For lLoop = LBound(parametri) To UBound(parametri) Step 2
qdf(parametri(lLoop)) = """" & parametri(lLoop + 1) & """"
Next

Set rsVal = qdf.OpenRecordset()
the last line raise me the error....
3001: Invalid Arguement

the query i call... is quite simple
Code:
PARAMETERS [codice presidio] Text ( 255 );
SELECT Max(fz_tutti.cod_fz) AS maxVal, IsNumeric([cod_fz]) AS condizione
FROM fz_tutti
GROUP BY IsNumeric([cod_fz])
HAVING (((IsNumeric([cod_fz]))=True));
this is not based upon a table, but upone a union query... i don't know if it could cause problem...
but i can opern the 2 query with no problem, directly.... the error raise by code....


any suggestion??
thenks

Receiving Error '3001' When Updating Recordset
THis is my first vb project so bear with me please.  I am creating a simple database with a vb 6 front end.  I am trying to track and assign id tags to equipment. I can get the primary recordset to save the main record, however this bit of code which should update the id tags is not working. I am receiving the following error:  Run-time error '3001' Arguments are of the wrong type, ,are out of range,  or are in conflict with one another.  Any ideas would be wonderful.  The table that needs to be updated has the following fields:

Number  <autonumber>
Category <text>
Description <text>
CategoryTagPrefix <text>
LastTagNumber <Number>
NextTagNumber <Number>

The debugger is highlighting the code:
  adoAssignID.Update sql
________________________________________

Private Sub cboCategory_Click()
  Dim intUserResponse As Integer
  'Dim adoAssignID As Recordset
  Dim sql, aLast, aNext, Name As String
  Dim db As Connection
  Set db = New Connection

  db.CursorLocation = adUseClient
  db.Open "PROVIDER=MSDASQL;dsn=Inventory;uid=sa;pwd=;"

  sql = "Select * from zAssetCategories Order by Category"
  
  Set adoAssignID = New Recordset
  Name = cboCategory

  'search for record
   adoAssignID.Open sql, db, adOpenStatic, adLockOptimistic
   adoAssignID.MoveFirst
   adoAssignID.Find "Category = '" & Name & "'", , adSearchForward, adBookmarkFirst
 
  txtFields(0) = Trim(adoAssignID![CategoryTagPrefix] & Str(adoAssignID![NextTagNumber]))

  aLast = (adoAssignID!NextTagNumber)
  aNext = (adoAssignID!NextTagNumber + 1)

  sql = "Update zAssetCategories LastTagNumber = '" & (Val(aLast)) & "'"
  sql = sql & ",NextTagNumber = '" & (Val(aNext)) & "'"
  sql = sql & "where Category = '" & (Trim(Name)) & "'"
  adoAssignID.Update sql
  
  Me.cboCategory.Enabled = False
  Me.txtFields(0).Enabled = False

End Sub

Thanks in advance for your help.

Andrea

Error 3001 - ADOX Create Relationships
Anyone know why I am getting

Error 3001 Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

for this, please?

Code:For Each CtlTbl In Ctl.Tables
        If InStr(1, CtlTbl.Name, "MSys", vbTextCompare) = 0 And CtlTbl.Type = "TABLE" Then
            For Each CtlKey In CtlTbl.Keys
                sGen = ""
                If CtlKey.RelatedTable <> "" Then
                    CtlKeyNew.Name = CtlKeySrc.Name
                    CtlKeyNew.Type = adKeyForeign
                    CtlKeyNew.RelatedTable = CtlKeySrc.RelatedTable
                    CtlKeyNew.Columns.Append CtlKeySrc.Columns(0).Name
                    CtlKeyNew.Columns(CtlKeySrc.Columns(0).Name).RelatedColumn = CtlKeySrc.Columns(0).RelatedColumn
                    sGen = sGen & CtlTbl.Name & ".Keys.Append " & CtlKeyNew.Name & ", " & CtlKeyNew.Type & ", " & CtlKeyNew.Columns(0).RelatedColumn & ", " & CtlKeyNew.RelatedTable
                    GenerateCode sGen & vbCrLf
                    Set CtlKeyNew = Nothing
                End If
            Next CtlKey
        End If
    Next CtlTbl

Cheers




Criticism comes easier than Craftmanship

Whilst I try and answer every thread there is, I find most of my answers to your posts here:

[Posting Guidelines] | [FAQ's] | [The Chosen One] | [Knowledge Search] | [Richie's Wisdom Forum]

Runtime Error 3001 : The Application Is Using Arguments.........
I want to export data from the Ms-Access database to the excel file thru VB.
I have written the following code on the click of a button.......

Open_Connection
sqlstr = "Select * from report"
MyRS2.CursorLocation = adUseClient
MyRS2.Open sqlstr, myconn, adOpenStatic, adLockBatchOptimistic
MyRS2.MoveFirst

Public Sub Open_Connection()
Dim database As String
database = "autodial"
Set myconn = New ADODB.Connection
myconn.ConnectionString Provider=Microsoft.Jet.OLEDB.3.51;Data Source= autodial.mdb;"
myconn.Open
End Sub

now in this code this error is coming "runtime error 3001 : The application is using arguments that are of wrong type, are out of acceptable range, or are in conflict with one another". This error is coming while opening the connection i.e. myrs2.open sqlstr....... statement.

what is the problem in this code?

Need Detective Work: .Find Returns Run-time Error '3001'
Dear VB afficionados,

My form returns an error when clicking either the cancel or OK button in the inputbox when nothing is on the inputbox line....then the debug directs me to the .Find line.

Here is the code for my command button:

Private Sub Command1_Click()
'locate record

Dim strName As String
strName = InputBox("Enter StudentID", "Find StudentID")

If Len(strName) = 0 Then
MsgBox "Please Enter A Value", vbCritical
End If
With Adodc1.Recordset
.MoveFirst
.Find "StudentID Like '" & strName & "*'", 0, adSearchForward
If .EOF Then
MsgBox "No Matching Records Found", , "Sorry"
MsgBox "Invalid User", vbCritical, "Error"
frmId3.Hide
frmIntro1.Show

End If
End With

End Sub

what is going on? keep in mind that if I enter a value in the input box, everything works great

thanks

Runtime Error 3001: Invalid Argument... After Processing Successfully For About 10 Minutes
Hi all, I seem to be having quite a problem.

I have an Access 2000 database set up to import two text files into tables and run some formatting/indexing work on them. Here's my problem. Let me dump some code in here to illustrate:

Code:
    Set rs1 = db.OpenRecordset("SELECT * FROM VoterHistoryFlag WHERE " & _
                               "Primary = False AND General = True AND " & _
                               "Special = False AND School = False ", dbOpenDynaset)
    rs1.MoveFirst
    strValue = "2"
    Do Until rs1.EOF = True
        Set rs2 = db.OpenRecordset("SELECT VoterID, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10 FROM Profile WHERE VoterID = '" & rs1!voterid & "'", dbOpenDynaset)
        UpdateFlag
        rs1.MoveNext
        rs2.Close
    Loop
    Debug.Print "Flag 2 is complete " & rs1.RecordCount
    rs1.Close


Followed by:

Code:
Public Sub UpdateFlag()
    rs2.Edit
    Select Case rs1!ElectionYear
        Case "1994"
            rs2!F10 = strValue
        Case "1995"
            rs2!F9 = strValue
        Case "1996"
            rs2!F8 = strValue
        Case "1997"
            rs2!F7 = strValue
        Case "1998"
            rs2!F6 = strValue
        Case "1999"
            rs2!F5 = strValue
        Case "2000"
            rs2!F4 = strValue
        Case "2001"
            rs2!F3 = strValue
        Case "2002"
            rs2!F2 = strValue
        Case "2003"
            rs2!F1 = strValue
    End Select
    rs2.Update
End Sub


Ok, this code works perfectly until I hit one specific record, more specifically, one VoterID and one ElectionYear (where
rs1!ElectionYear = "1997"). This same voter has other records and they update just fine RIGHT before this one record, and then it stops with the following error:

Run-Time Error: 3001, Invalid argument.

For the life of me I can't figure out why this is happening. Anyone run into something like this before?

Thanks for your help!

Rs.Filter And Check For Eof And Bof. [Resolved!]
Maybe this is an easy problem for you:

When i search for people at the recordset I use rs.Filter, but when the given doesnt exist. It gives me an error that i cant handle properly.

rs.bof or rs.eof. How can i handle this good? I tried it so please check my code and you get a pretty good idea what i mean.

Thank you all!

Walter.

This is my code:


VB Code:
Private Sub button_Zoeken_Click()'#############################################'Button searchIf Len(txt_ZoekTermAchternaam) Then 'If last name is filled        If Len(txt_ZoekTermVoornaam) Then 'and if first name is also filled..then search also at first name...           rs.Filter = "Naam Like '%" & txt_ZoekTermAchternaam & "%' AND Voornaam Like '" & txt_ZoekTermVoornaam & "%'"       ' If Not (rs.RecordCount < 1) Then            txt_voornaam = rs.Fields("voornaam").Value            txt_achternaam = rs.Fields("naam").Value            txt_adres = rs.Fields("adres").Value            txt_postcode = rs.Fields("postcode").Value            txt_telefoonnummer = rs.Fields("Telefoonnummer").Value            txt_VriendOfLid = rs.Fields("vriendoflid").Value            txt_plaats = rs.Fields("woonplaats").Value            foto = rs.Fields("Foto").Value            load_Picture (foto)       ' Else       '     MsgBox "warning when given name doesnt exist"       ' End If    Else 'Or else just search on the last name.        rs.Filter = "Naam Like '" & txt_ZoekTermAchternaam & "%'"        'If (rs.BOF And rs.EOF) Or (rs.BOF Or rs.EOF) Then            txt_voornaam = rs.Fields("voornaam").Value            txt_achternaam = rs.Fields("naam").Value            txt_adres = rs.Fields("adres").Value            txt_postcode = rs.Fields("postcode").Value            txt_telefoonnummer = rs.Fields("Telefoonnummer").Value            txt_VriendOfLid = rs.Fields("vriendoflid").Value            txt_plaats = rs.Fields("woonplaats").Value            foto = rs.Fields("Foto").Value            load_Picture (foto)        'Else        '     MsgBox "warning when given name doesnt exist"        'End If    End IfElse    MsgBox "Het Achternaamveld is leeg"       End If

RESOLVED Detecting Dialog Filter
Hello, I want my app to be able to save both plain text files and rtf files, I am using a common dialog control to open the save dialog and open dialog, and i have filters set, but how can i choose what filter is chosen so that the file can be saved a certain way?

Filter The Internet Connections [not Resolved, But End]
Hello,
How can I filter the internet connections BEFORE it gets to the programs that are swapping data. I want to filter through and if it contains certain data, it won't let it come through. Is this possible?

Thanks,
alacritous

Also: Does this have anything do to with a proxy? What even is a proxy?

File Filter Dilemma - *Resolved*
Hey guys, I have a small problem. I want to show the Open DialogBox, but have the default file filter be set to "All Image Files", and have it showing files of the type bmp, jpg, jpeg, and gif.

I have the following code, but it doesn't work. It displays the correct text ("All Image Files (*.bmp), (*.jpg), (*.jpeg), (*.gif)" in the drop-down on the dialogbox, however, creates several blank text entry's below it, each which are one of the filters.

How can I have it so that the default filter is All Image Files, and show the types of files listed above?


VB Code:
Dim sFileFilter As StringsFileFilter = "All Image Files (*.bmp), (*.jpg), (*.jpeg), (*.gif)|*.bmp| |*.jpg| |*.jpeg| |*.gif|"With CommonDialog2    .Filter = sFileFilter    ' Some other flags and such are here    .ShowOpen    ' Some other code related to my program is hereEnd With

Resolved - Filter For Null Values
How do you filter a recordset for Null Values and Empty Values (zero length)?

I have an ADO recordset (rs1) with some records on it. Now I want to Filter for Records with null and empty values in the Age field.

rs1.Filter = "IsNull([Age]) = True"
rs1.Filter = "IsEmpty([Age]) = True"
rs1.Filter = "Len([Age]) = 0"

The above approaches don't work.

Help pls.



Edited by - ykdis on 7/5/2004 10:51:43 PM

Common Dialog Filter - Not An Option? RESOLVED
having searched on here, the msdn library and the interne in general, I am completely baffled.

I cannot get the commondialog to work

when i enter commondialog1. in the drop down list of options, filter is not included.

even if i copy and paste the example from msdn, it doesn't work

anyone seen this before? am i being stupid

cheers
Graham

Common Dialogue Box Filetype Filter *RESOLVED*
Hey,
Whenever i run this part of my program (it opens up the common control dialogue box) the file filter is just blank. Any ideas?


VB Code:
With cdlDB        .ShowOpen        .Filter = "Access Database (*.mdb)|*.mdb"    End With


Thanks for your help.

ADO Filter - Embedded Single Quote **Resolved **
I'm using VB6 -

I have a filter statement as follows :

FigRS.Filter = "[code] = '" & RS![code] & "' AND [Session]=" & Session

using RS![code] that has an embedded single quote eg :
4T'R-11F

This returns error code 3001
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

What is the correct syntax to use in order to accomodate this criteria - this is the only 'problem' character that I would come across.

Thanks in advance!

Building A Filter For Funky Text...RESOLVED *I Think
I've got a textbox full of messed up text. It's basically the text that I want, but with a TON of symbols and characters.
Check out a screenshot of my problem here:
Weird Text
I want to build a filter to get rid of all the unwanted text, but I have no clue how to do this. Any help on this is great! Thx.

P.S all the text displayed in that textbox is stored in "a$"

RESOLVED Having Problem With Building A Report Filter
Hello Everyone!

I am building a small Report Filter where I have a criteria selection form with Fields Company Name and Ordered Between. And based on the users selections it Builds a query and displays a Report. I have coded a Function that Builds the Query but for some reason I can't get it to filter the report based of the Users selection on the form.

When I run the form it doesn't pick up the WHERE clause and just displays the Report without the filter.


Here is my Function Code:
Code:
Function BuildSQLString(ByRef strSQL As String) As Boolean

    Dim strSELECT As String
    Dim strFROM As String
    Dim strWHERE As String
    
    strSELECT = "SELECT s.* "
    
    strFROM = "FROM tblSales AS s"
    
    If chkCompanyID Then
        If strWHERE <> "" Then strWHERE = strWHERE & " AND "
        strWHERE = strWHERE & "s.fkCompanyID = " & cboCompanyID
    End If
    
      If chkDateOrdered Then
    If Not IsNull(txtDateFrom) Then
      'Check for 2nd or more WHERE term
      If strWHERE <> "" Then strWHERE = strWHERE & " AND "
      strWHERE = strWHERE & "s.DateOrdered >= " & _
        "#" & Format$(txtDateFrom, "mm/dd/yy") & "#"
    End If
    If Not IsNull(txtDateTo) Then

      'Check for 2nd or more WHERE term
      If strWHERE <> "" Then strWHERE = strWHERE & " AND "
      strWHERE = strWHERE & "s.DateOrdered <= " & _
        "#" & Format$(txtDateTo, "mm/dd/yy") & "#"
    End If
  End If
  
  strSQL = strSELECT & strFROM
  If strWHERE <> "" Then strSQL = strSQL & "WHERE " & strWHERE

  BuildSQLString = True
    
End Function


and Here is the Find Button code on the Form that calls the above function:
Code:
Private Sub cmdFind_Click()
    Dim strSQL As String
    
    If Not BuildSQLString(strSQL) Then
        MsgBox "There was a Problem building the SQL String"
    
        Exit Sub
    End If
    
    MsgBox strSQL
    
    CurrentDb.QueryDefs("qryExample").SQL = strSQL
    
    DoCmd.OpenReport "rptSales", acViewPreview
    
End Sub

could any one tell me what I might be doing wrong, I have attached a sample file of my database.

Thanks..



Edited by - kiite on 9/25/2007 7:37:09 AM

[RESOLVED 10 Mins Down To 25 Seconds]this Filter Takes To Long .. Is There Any Other Way?
Hey all,

I have a spreadsheet full of data of which i need to filter out (delete) all rows that start have certian lines in their A column. I have tried 2 things thus far and both of them take forever. I need to know if there is possibly a quicker way of doing this .. here are my 2 attempts...

Code:Sub CleanUp() 'Eliminates unwanted lines

Dim oApp3 As Excel.Application
Set oApp3 = New Excel.Application
Dim objWorkBook As New Excel.Workbook
Dim X As Integer

VBA.FileSystem.ChDir "F:Inventory"
    oApp3.Workbooks.Open FileName:= _
        "F:InventoryAuditTest.xls"

Set objWorkBook = oApp3.Workbooks("AuditTest.xls")

For X = 2000 To 1 Step -1

If objWorkBook.Worksheets("dbo_AUDIT_DV_DEVICE_DUPLICATE_A").Range
("A" & X) = "AUDIT FAILURE" Or objWorkBook.Worksheets("dbo_AUDIT_DV_DEVICE_DUPLICATE_A").Range("A" & X) = Null Or .....''''many Or's

Then

    objWorkBook.Worksheets("dbo_AUDIT_DV_DEVICE_DUPLICATE_A").Range(X & ":" & X).Delete

End If
Next X
'Save
    oApp3.Windows("AuditTest").Activate
    oApp3.DisplayAlerts = False

    oApp3.ActiveWorkbook.SaveAs FileName:="F:InventoryAuditFinal.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False

'Quit and Exit
oApp3.Quit
Set oApp3 = Nothing
Set objWorkBook = Nothing

End Sub


Attempt # 2

Code:Sub CleanUp() 'Eliminates unwanted lines

Dim oApp3 As Excel.Application
Set oApp3 = New Excel.Application
Dim objWorkBook As New Excel.Workbook
Dim oRange2 As Range

Dim X As Integer

VBA.FileSystem.ChDir "F:Inventory"
    oApp3.Workbooks.Open Filename:= _
        "F:InventoryAuditTest.xls"

Set objWorkBook = oApp3.Workbooks("AuditTest.xls")

For X = 5000 To 1 Step -1


If objWorkBook.Worksheets("dbo_AUDIT_DV_DEVICE_DUPLICATE_A").Range("A" & X) = "AUDIT FAILURE" Then
objWorkBook.Worksheets("dbo_AUDIT_DV_DEVICE_DUPLICATE_A").Range(X & ":" & X).Delete
End If

If objWorkBook.Worksheets("dbo_AUDIT_DV_DEVICE_DUPLICATE_A").Range("A" & X) = Null Then
objWorkBook.Worksheets("dbo_AUDIT_DV_DEVICE_DUPLICATE_A").Range(X & ":" & X).Delete
End If

.'' many if end ifs...
.''
.''


Next X
'Save
    oApp3.Windows("AuditTest").Activate
    
    oRange2("A1").Select
    
    oApp3.DisplayAlerts = False

    oApp3.ActiveWorkbook.SaveAs Filename:="F:InventoryAuditFinal.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False

'Quit and Exit
oApp3.Quit
Set oApp3 = Nothing
Set objWorkBook = Nothing

End Sub

Hmm, I got another idea: Check for criteria, if there is a hit enter row number into an array, at the end of the list delete all the rows that have row numbers in that array? would that make this go faster or is the bottleneck checking numerous search critera?

Thx

Thx in advance
Doc




Edited by - doctor on 7/23/2004 6:54:59 AM

[RESOLVED}Modify Form Filter Code To Do Nothing If No Matching Record If Found
I need help modifying the following code so that it will do nothing if there is no matching record.

Private Sub Tag_LostFocus()
On Error GoTo Err_Command1735_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Advisories"

stLinkCriteria = "[Tag]=" & "'" & Me![Tag] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command1735_Click:
Exit Sub

Err_Command1735_Click:
MsgBox Err.Description
Resume Exit_Command1735_Click

End Sub


RESOLUTION:

if IsNull(Dlookup("[Tag]","TABLENAME","[Tag]='" & me![Tag] & "'")) then exit sub

Filter Error
when i use filter, it doesn't work

i input the ID no. in a textbox but it does not search the ID. It does nothing.

here's my code:


private sub txtEmpID_Change()

with adoID
.requery
.filter = "[Emp ID]=' " & txtEmpID.text & " ' "
end with

end sub


what seems to be the problem?

please help me....

thanks!

Filter Property Error
Im facing a severe problem in Adodb's Filter propoerty.

I know how to use it and where it shud use. Usualy to filter a recordset Im giving the field name and relevant values. If I give the field name directly, then it is working fine. But If I give the field nama as a variable then Problem is coming

This is working fine

Code:
grstStore.Filter = "City ='" & txtSortString.Text & "'"

But I want to paramaeterise the Fieldname. Bcos user can select any filed from any Select statement. Therefore Im giving like this


Code:
grstStore.Filter = lFieldName = " & txtSortString.Text & "
'Here lFieldName is a parameter

This is throw an error :"Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another."

I understand that My syntax is worng. But I cud not make the sysntax to work properly

Pls help me out, Im in little bit of hurry

Thanks
A.Rajeeshun

Run-Time Error Filter Is To Long
I am using Access 2000 VB
I use the following code to allow the user to select items from a ListBox to be printed in a report . If the user selects more than 50 items I get a Run_Time Error #7769 "Filter cancelled because it is to long"

If anybody has a fix to this proplem it would be greatly appreciated.

Thank You

Private Sub cmdPreview_Click()
Dim vntItem As Variant, strFilter As String
Dim rptMyReport As New [Report_Count Sheet Report]


For Each vntItem In Me![1stProduct].ItemsSelected
' Concatenate single quotes around the customer id
' because the CustomerID field is Text.
strFilter = strFilter & "[ProductName] = '" & _
Me![1stProduct].ItemData(vntItem) & "' OR "
Next
' Remove the OR string from the end of the filter
' condition if a filter exists.
If strFilter <> "" Then
strFilter = Left(strFilter, Len(strFilter) - 4)
' Preview the report, and pass the filter string
DoCmd.OpenReport rptMyReport.Name, acPreview, , strFilter
Else
MsgBox "No Products Have Been Selected"
End If

End Sub

Open Dialog Filter Error
hi i want to put a filter to see only the file .txt but it doesn't work...


With cdlOpen
.DialogTitle = "MediaPlayer"
.Filter = "*.txt"
.InitDir = "."
.ShowOpen
End With

what the error...

Copyright 2005-08 www.BigResource.com, All rights reserved