473,890 Members | 1,363 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Selectinhg only filtered records (boolean?)

Hi everyone,

I am trying to open the form "Languages" with a diffrent record
source
to the "Contacts" form where I conducted the search or filter... .

I was wondering whether there was a vba code to select
ONLY ALL FILTERED records of my first form or the "Contacts"
and open this filtered set of records in my "Languages" form. I have a
key field on both tables named id_individual.

Most posts I have seen have only refered to linking just !!one
record!! to another form. I want to select all filtered records in my
continous form to pass on to another continous form.

Subsequently the idea would be to filter those records with the
selected languages.

At the moment I have been using unbound checkboxes with hiden
functions on the background to select each individual contact to be
stored as boolean. The selected records could then be opened in the
"language" form without any problem....

obviously this is a problem when there is over 100 contacts to select
from...
>>>>>>>>>>>>>he re is extract of the code used to select the checkboxes of each individual to then pass on to another form.<<<<<<<<<< <<<<<<<<
' Assigns Boolean
Dim colCheckBox As New Collection

Public Function IsChecked(vID As Variant) As Boolean

Dim lngID As Variant

IsChecked = False

If IsNull(vID) = True Then Exit Function

For Each lngID In colCheckBox
If vID = lngID Then
IsChecked = True
Exit For
End If
Next lngID

End Function
-------------------------------

' some back end code
Private Sub Check11_KeyDown (KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeySpace Then
KeyCode = 0
Call Command64_Click
End If

End Sub
------------------------------------------------
' This is the function placed behind the unbound checkbox found in the
Detail section of the form.
' This command saves the id.individual of the record selected as
boolean

Private Sub Command64_Click ()

Debug.Print "id_individ ual = " & Me.id_individua l

If IsChecked(Me.id _individual) = False Then
colCheckBox.Add CLng(Me.id_indi vidual), CStr(Me.id_indi vidual)
Else
colCheckBox.Rem ove (CStr(Me.id_ind ividual))
End If
Me.check11.Requ ery

End Sub

--------------------------------------------------------------

' Function to collect the selected records

Private Function MySelected() As String
Dim i As Integer

For i = 1 To colCheckBox.Cou nt
If MySelected <"" Then
MySelected = MySelected & ","
End If
MySelected = MySelected & colCheckBox(i)

Next i
End Function
---------------------------
' other backend code.. I assume to visualy select and deselect
checkboxes
Private Sub Form_KeyDown(Ke yCode As Integer, Shift As Integer)

' key hand

Select Case KeyCode

Case vbKeyUp
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecor d acActiveDataObj ect, , acPrevious

Case vbKeyDown
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecor d acActiveDataObj ect, , acNext

Case vbKeyReturn
If IsNull(Me.id_in dividual) = False Then
KeyCode = 0
Call EditMain
End If

End Select

End Sub

----------------------------------------------
' Finally the code to open the form with "Myslected" records
Private Sub expertise_Click ()

'Dim strLinkCriteria As String

Dim strWhere As String
strWhere = MySelected

If strWhere <"" Then

strWhere = "id_individ ual in (" & strWhere & ")"

End If
DoCmd.OpenForm "expertise_sear ch", acNormal, , strWhere


End Sub
----------------------------------------------------------------------------

<<<<<><<<<<<<<< <<

I am not... interested in using sub_forms.. for the simple fact you
cannot view records in a continous mode..
I am just looking for a solution iether by selecting all the
checkboxes of each filtered contact as boolean or by connecting i.e
all ID_contact(s) of one filtered form to another filtered form..
I hope I am not asking too much...

Aug 28 '07 #1
4 2943
On Tue, 28 Aug 2007 06:47:09 -0700, Ironr4ge
<sc************ ***@yahoo.comwr ote:

If I understand you correctly you would want to open L with a query
like this (L and C are forms and tables):
select * from L where ContactID in (select ContactID from C)

The way I do that is to first put the ContactIDs of the filtered C in
a "temp" table, and then inner join L with that table. This can be
done with a few lines of DAO code looping over C's recordsetclone.

-Tom.

>Hi everyone,

I am trying to open the form "Languages" with a diffrent record
source
to the "Contacts" form where I conducted the search or filter... .

I was wondering whether there was a vba code to select
ONLY ALL FILTERED records of my first form or the "Contacts"
and open this filtered set of records in my "Languages" form. I have a
key field on both tables named id_individual.

Most posts I have seen have only refered to linking just !!one
record!! to another form. I want to select all filtered records in my
continous form to pass on to another continous form.

Subsequently the idea would be to filter those records with the
selected languages.

At the moment I have been using unbound checkboxes with hiden
functions on the background to select each individual contact to be
stored as boolean. The selected records could then be opened in the
"language" form without any problem....

obviously this is a problem when there is over 100 contacts to select
from...
>>>>>>>>>>>>>>h ere is extract of the code used to select the checkboxes of each individual to then pass on to another form.<<<<<<<<<< <<<<<<<<
' Assigns Boolean
Dim colCheckBox As New Collection

Public Function IsChecked(vID As Variant) As Boolean

Dim lngID As Variant

IsChecked = False

If IsNull(vID) = True Then Exit Function

For Each lngID In colCheckBox
If vID = lngID Then
IsChecked = True
Exit For
End If
Next lngID

End Function
-------------------------------

' some back end code
Private Sub Check11_KeyDown (KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeySpace Then
KeyCode = 0
Call Command64_Click
End If

End Sub
------------------------------------------------
' This is the function placed behind the unbound checkbox found in the
Detail section of the form.
' This command saves the id.individual of the record selected as
boolean

Private Sub Command64_Click ()

Debug.Print "id_individ ual = " & Me.id_individua l

If IsChecked(Me.id _individual) = False Then
colCheckBox.Add CLng(Me.id_indi vidual), CStr(Me.id_indi vidual)
Else
colCheckBox.Rem ove (CStr(Me.id_ind ividual))
End If
Me.check11.Requ ery

End Sub

--------------------------------------------------------------

' Function to collect the selected records

Private Function MySelected() As String
Dim i As Integer

For i = 1 To colCheckBox.Cou nt
If MySelected <"" Then
MySelected = MySelected & ","
End If
MySelected = MySelected & colCheckBox(i)

Next i
End Function
---------------------------
' other backend code.. I assume to visualy select and deselect
checkboxes
Private Sub Form_KeyDown(Ke yCode As Integer, Shift As Integer)

' key hand

Select Case KeyCode

Case vbKeyUp
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecor d acActiveDataObj ect, , acPrevious

Case vbKeyDown
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecor d acActiveDataObj ect, , acNext

Case vbKeyReturn
If IsNull(Me.id_in dividual) = False Then
KeyCode = 0
Call EditMain
End If

End Select

End Sub

----------------------------------------------
' Finally the code to open the form with "Myslected" records
Private Sub expertise_Click ()

'Dim strLinkCriteria As String

Dim strWhere As String
strWhere = MySelected

If strWhere <"" Then

strWhere = "id_individ ual in (" & strWhere & ")"

End If
DoCmd.OpenFo rm "expertise_sear ch", acNormal, , strWhere


End Sub
----------------------------------------------------------------------------

<<<<<><<<<<<<< <<<

I am not... interested in using sub_forms.. for the simple fact you
cannot view records in a continous mode..
I am just looking for a solution iether by selecting all the
checkboxes of each filtered contact as boolean or by connecting i.e
all ID_contact(s) of one filtered form to another filtered form..
I hope I am not asking too much...
Aug 28 '07 #2
On Aug 28, 4:33 pm, Tom van Stiphout <no.spam.tom7.. .@cox.netwrote:
On Tue, 28 Aug 2007 06:47:09 -0700, Ironr4ge

<scherrer_ricca ...@yahoo.comwr ote:

If I understand you correctly you would want to open L with a query
like this (L and C are forms and tables):
select * from L where ContactID in (select ContactID from C)

The way I do that is to first put the ContactIDs of the filtered C in
a "temp" table, and then inner join L with that table. This can be
done with a few lines of DAO code looping over C's recordsetclone.

-Tom.

Thanks for the reply Tom,

This would be a perfect solution which I had not fully envisioned
before. I will do some research into this method today. However, if
you know (or anyone for that matter) a particular post which explains
this step by step, I would realy appreciate if you posted a link.

Cheers,

Ricky,

Aug 29 '07 #3
On Aug 29, 11:14 am, Ironr4ge <scherrer_ricca ...@yahoo.comwr ote:
On Aug 28, 4:33 pm, Tom van Stiphout <no.spam.tom7.. .@cox.netwrote:
On Tue, 28 Aug 2007 06:47:09 -0700, Ironr4ge
<scherrer_ricca ...@yahoo.comwr ote:
If I understand you correctly you would want to open L with a query
like this (L and C are forms and tables):
select * from L where ContactID in (select ContactID from C)
The way I do that is to first put the ContactIDs of the filtered C in
a "temp" table, and then inner join L with that table. This can be
done with a few lines of DAO code looping over C's recordsetclone.
-Tom.

Thanks for the reply Tom,

This would be a perfect solution which I had not fully envisioned
before. I will do some research into this method today. However, if
you know (or anyone for that matter) a particular post which explains
this step by step, I would realy appreciate if you posted a link.

Cheers,

Ricky,
Ya sorry.. forgot to ask will this method be viable in a multi user
environment.?'

Aug 29 '07 #4
On Wed, 29 Aug 2007 03:09:56 -0700, Ironr4ge
<sc************ ***@yahoo.comwr ote:

Yes. You either put the temp table in the front-end, or (e.g. if SQL
Server is your BE and you're in an ADP) you add a column MachineName
to the temp table.

-Tom.

>On Aug 29, 11:14 am, Ironr4ge <scherrer_ricca ...@yahoo.comwr ote:
>On Aug 28, 4:33 pm, Tom van Stiphout <no.spam.tom7.. .@cox.netwrote:
On Tue, 28 Aug 2007 06:47:09 -0700, Ironr4ge
<scherrer_ricca ...@yahoo.comwr ote:
If I understand you correctly you would want to open L with a query
like this (L and C are forms and tables):
select * from L where ContactID in (select ContactID from C)
The way I do that is to first put the ContactIDs of the filtered C in
a "temp" table, and then inner join L with that table. This can be
done with a few lines of DAO code looping over C's recordsetclone.
-Tom.

Thanks for the reply Tom,

This would be a perfect solution which I had not fully envisioned
before. I will do some research into this method today. However, if
you know (or anyone for that matter) a particular post which explains
this step by step, I would realy appreciate if you posted a link.

Cheers,

Ricky,

Ya sorry.. forgot to ask will this method be viable in a multi user
environment. ?'
Aug 29 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4816
by: origin197511 | last post by:
Hello all... I'm having an issue with MSAccess 2000. I have a Form that holds records of my cartridge loads for a rifle and a subform that lists all groups that have been fired with that load. They are linked by the load_id field and when I just browse through the loads everything shows up correctly. Each recorded group is displayed on a line of the datasheet subform. However, when I filter the form for say my "Selected" flag...
6
9362
by: GSteven | last post by:
(as formerly posted to microsoft.public.access.forms with no result) I've created a continuous form which is based on a straightforward table (ex - customers - 100 records). On the form there is a checkbox with a control source named "MARK" (boolean) from customer table. I can check and uncheck individual records fine. Then I created 2 command buttons named "Select All" and "Deselect All". The Onclick property of these buttons runs code...
1
1545
by: Tim | last post by:
Hi I am implementing some printing in C# and I need to get the data for it. I am using a datagrid. I can sort the data and filter it. I want to get a datatable of only the data visible in the datagrid. The underlying dataview holds all the records. If I have a dataview with 80 records in but the user does a filter in the datagrid, I want to get only the 5 filtered records. Can anyone help me with this one?
1
5432
by: Ken | last post by:
I have a form that has a command button on it to open a report. The report is based on the forms data, if it's filtered the report is filtered, if the form is showing 100 records the report is showing the same 100 records, etc. I want to create another command button which exports to excel, in the same manner above. Whether the form is filtered or not, the same records should be exported. I played around with TransferSpreadsheet but I...
3
3469
by: melnhed | last post by:
---Report the current filtered records from a Form--- Hello All, I've seen this topic discussed before, but the solution described then doesn't work in my particular case. My Config: Access 2002 front-end using SQL Server 2000 (MSDE actually) via ADP/ADE Access Data Project.
0
1690
by: Ironr4ge | last post by:
Hi everyone, By the rate its going it want be long till I start growing gray hair... but anyway.. to come to the point... I am trying to open the form "Languages" with a diffrent record source to the "Contacts" form where I conducted the search or filter... . I was wondering whether there was a simple vba code to select ONLY ALL FILTERED records of my first form or the "Contacts"
2
19332
by: atlbearcat | last post by:
Here's one that's been bugging me for about a week now... I have a form that allows users to filter records, simple enough. But I want to give them the option to export the filtered records to Excel. I don't want to use the docmd.outputTo due to it won't filter the records, it puts all of the records in the file. I've looked around and found some code (actually that I'm already using), but the problem is that it outputs EVERYTHING on the...
6
1961
by: Nettle | last post by:
Purpose: I am creating a mailing distribution list database. Users should be able to filter/search contacts and add them to distribution lists they have created. My problem? I can't add multiple, filtered contacts to the proper distribution list. I have two main forms, described below. These forms are based on three tables. Tables tbl_MainContact: Holds all contact information tbl_JoinContactToDistributionList: A join table
6
2364
jinalpatel
by: jinalpatel | last post by:
I am using following code for searching records. 'Purpose: Build up the criteria string form the non-blank search boxes, and apply to the form's Filter. 'Notes: 1. We tack " AND " on the end of each condition so you can easily add more search boxes; _ we remove the trailing " AND " at the end. Dim strWhere As String 'The criteria string. Dim lngLen As...
0
10810
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10918
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9625
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8015
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7169
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5845
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6041
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4674
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4270
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.