473,320 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Copying the filtered data - StrWhere

I have a VB code to filter data and show the data in form and it works fine, My problem is how I can add code to copy this filtered data to a table??

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdFilter_Click()
  2.  
  3.     Dim strWhere As String
  4.     Dim lngLen As Long
  5.  
  6.     If Not IsNull(Me.txtFilterType) Then
  7.         strWhere = strWhere & "([AcctGroupName] Like ""%" & Me.txtFilterType & "%"") AND "
  8.     End If
  9.     If Not IsNull(Me.txtText16) Then
  10.         strWhere = strWhere & "([AccTypeName] Like ""%" & Me.txtText16 & "%"") AND "
  11.     End If
  12.     lngLen = Len(strWhere) - 5
  13.     If lngLen <= 0 Then
  14.         MsgBox "No criteria", vbInformation, "Nothing to do."
  15.     Else
  16.         strWhere = Left$(strWhere, lngLen)
  17.  
  18.         Me.Filter = strWhere
  19.         Me.FilterOn = True
  20.  
  21.     End If
  22.     Me.Requery
  23.  
  24. End Sub 
Oct 18 '12 #1
6 3395
Rabbit
12,516 Expert Mod 8TB
The first question is, why would you need to? Keeping an extra copy of similar data is not good practice unless you can justify it. And there are very few justifications that will make it worth while. It's better to just save it as a query and run the query when you need the data rather than saving the actual data.
Oct 18 '12 #2
no i need it to do some justifications on the new table, can you help me with the code please?
Oct 18 '12 #3
zmbd
5,501 Expert Mod 4TB
msamhouri
I agree VERY strongly with Rabbit. Unless you need this information for historical reasons then what you are doing is not the best use of the database.

Also... demanding code from volunteers such as Rabbit (or myself.. this is Hobby) is not the way to get any help what so ever!

To point you in the right direction... you can do a make-table query based on the filter set in your form. [F1] in access and search on maketable.
Try to do this on your own first and post back any efforts you make... we'll go from there.
Oct 19 '12 #4
Rabbit
12,516 Expert Mod 8TB
Well, you haven't given a good reason for the need to do this. But if you have to, you can use a select into query to create a table.
Oct 19 '12 #5
thank you i found the solution in other website... have a good day
Oct 19 '12 #6
NeoPa
32,556 Expert Mod 16PB
I'm very pleased to say that it is rare for experts on here to give incorrect and inappropriate answers simply because the OP fails to understand the situation clearly themselves.

That said, the answer was provided here (See post #5), albeit with strong warnings as befits such an answer.
Oct 19 '12 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: 21novembre | last post by:
Hi all, I made a question several days before to describe my strange trouble of mysqldump. But I still can't figour it out. Well, I just want to ask another question whether I could just backup...
1
by: VMI | last post by:
How can I dump a datatable into an Access table (which contais exactly the same structure)? Somebody suggested doing this with a dataAdapter. I don't want to run an Insert query for each record (I...
0
by: Neo | last post by:
I am trying to use the clipboard to exchange generic binary Data with my applications and others like the Visual Studio Hex Editor. The data that comes from the Visual Studio Hex editor is in...
0
by: gouraud | last post by:
Hello, I'm working on Visual Web Developper (ASPX with C# code Behind) I would like to fill a DataList with items using this format (with as item as elements) : "file - element", example :...
0
raveenrs
by: raveenrs | last post by:
Hi, I'm new to DB2, having to move from a flat-file non-sql database to DB2. I'm currently trying to work out how to convert all our "custom" linux scripts to be compatible with DB2. Currently,...
2
by: O.B. | last post by:
When using Marshal to copy data from a byte array to the structure below, only the first byte of the "other" array is getting copied from the original byte array. What do I need to specify to get...
8
by: ALTAFAD | last post by:
How to copy selected (s) textfield, which those selected through checkbox I like to copy in clipboard. Access textfield data when front of the textfield checkbox is checked if not checked it...
0
by: sarvmardan | last post by:
how to open a report in access containing filtered data using two combo boxes on form and a button to click. let i have two fields and other is . two comboboxes are combo11 and combo9. plz post...
0
by: John James | last post by:
I need to create a new Access DB based on one already existing...Hence, I am attempting to copy the db struture and not the data; It's a yearly db I need to track/create. I looked on this site and...
1
by: Alexander A | last post by:
Good day. I have a number of xml files in a folder. Each file contains data on a single work project. Also I have a single excel spreadsheet and I manually copy the required data (project no,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.