473,416 Members | 1,727 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,416 software developers and data experts.

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...
>>>>>>>>>>>>>here 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_individual = " & Me.id_individual

If IsChecked(Me.id_individual) = False Then
colCheckBox.Add CLng(Me.id_individual), CStr(Me.id_individual)
Else
colCheckBox.Remove (CStr(Me.id_individual))
End If
Me.check11.Requery

End Sub

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

' Function to collect the selected records

Private Function MySelected() As String
Dim i As Integer

For i = 1 To colCheckBox.Count
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(KeyCode As Integer, Shift As Integer)

' key hand

Select Case KeyCode

Case vbKeyUp
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecord acActiveDataObject, , acPrevious

Case vbKeyDown
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecord acActiveDataObject, , acNext

Case vbKeyReturn
If IsNull(Me.id_individual) = 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_individual in (" & strWhere & ")"

End If
DoCmd.OpenForm "expertise_search", 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 2913
On Tue, 28 Aug 2007 06:47:09 -0700, Ironr4ge
<sc***************@yahoo.comwrote:

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...
>>>>>>>>>>>>>>here 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_individual = " & Me.id_individual

If IsChecked(Me.id_individual) = False Then
colCheckBox.Add CLng(Me.id_individual), CStr(Me.id_individual)
Else
colCheckBox.Remove (CStr(Me.id_individual))
End If
Me.check11.Requery

End Sub

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

' Function to collect the selected records

Private Function MySelected() As String
Dim i As Integer

For i = 1 To colCheckBox.Count
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(KeyCode As Integer, Shift As Integer)

' key hand

Select Case KeyCode

Case vbKeyUp
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecord acActiveDataObject, , acPrevious

Case vbKeyDown
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecord acActiveDataObject, , acNext

Case vbKeyReturn
If IsNull(Me.id_individual) = 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_individual in (" & strWhere & ")"

End If
DoCmd.OpenForm "expertise_search", 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.comwrote:

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.comwrote:
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.comwrote:
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.comwrote:

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.comwrote:
>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.comwrote:
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
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. ...
6
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...
1
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...
1
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...
3
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: ...
0
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...
2
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...
6
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,...
6
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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,...
0
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...
0
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...

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.