473,461 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Inner Join question!

Hi everyone,

I was wondering whether is was possible to select only the filtered
records of one form with Recordsource = "C" and open a diffrent form
with recordsource "L" . The way I was thinking accompleshing this was
by using the following innerjoin statement.. and code to open form...
-----------------------------------------------------------------------
Private Sub cmdFilter_Click()

Dim strWhere As String 'The criteria string.
Dim lngLen As Long 'Length of the criteria string to append to.

Dim msg2 As String
Dim strSQL As String

strSQL = "SELECT DISTINCT [visiting_instructor_language].
[id_individual] " & _
" FROM [visiting_instructor_language] INNER JOIN
visiting_instructor_country ON [visiting_instructor_language] " & _
".[id_individual] = visiting_instructor_country.[id_individual] " & _
"WHERE "

'Another text field example. Use Like to find anywhere in the
field.
If Not IsNull(Me.Countryexp) Then
strWhere = strWhere & "([country] like ""%" & Me.Countryexp &
"%"") AND "
End If
If Not IsNull(Me.from) Then
strWhere = strWhere & "([fromdate] >= " & "#" &
Format(Me.from, "short date") & "#" & ") AND "
End If

'Another date field example. Use "less than the next day" since
this field has times as well as ' dates.
If Not IsNull(Me.To) Then 'Less than the next day.
strWhere = strWhere & "([todate] < " & "#" & Format(Me.To + 1,
"short date") & "#" & ") AND "
End If

lngLen = Len(strWhere) - 5
If lngLen <= 0 Then 'Nah: there was nothing in the string.
MsgBox "No criteria", vbInformation, "Nothing to do."
Else 'Yep: there is something there, so remove
the " AND " at the end.
strWhere = Left$(strWhere, lngLen)

Debug.Print strWhere

Me.Filter = strWhere
Me.FilterOn = True
End If

' Code to open form

If MsgBox(msg2, vbQuestion + vbYesNo) = vbYes Then
msg2 = "Filter by Languages?"
Dim language As String
language = strSQL
If language <"" Then

language = "id_individual in (" & language & ")"

DoCmd.OpenForm "language_search", acNormal, , language
End If

End If

-------------------------------------------------------------------------------------
the following code gives me the common "Runtime error 30025" which I
assume is pointing at the fact that we have filtered these records
using a diffrent record source.. However... the intention was only to
select the id_individual (which is link between both tables) of all
filtered record to open on the second form with a diffrent
recordsource (L).
I know one of the solution would be to use the sub_form structure but
my desire is to always have a continous form when look at each
individual record details.

If anyone can spot an error in this code or a possible to solution to
make it work I would be very greateful....

Ric

Aug 31 '07 #1
0 1225

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

Similar topics

3
by: Ike | last post by:
Oh I have a nasty query which runs incredibly slowly. I am running MySQL 4.0.20-standard. Thus, in trying to expedite the query, I am trying to set indexes in my tables. My query requires four...
3
by: Prem | last post by:
Hi, I am having many problems with inner join. my first problem is : 1) I want to know the precedance while evaluating query with multiple joins. eg. select Employees.FirstName,...
8
by: kieran | last post by:
Hi, I have the following sql statement. I originally had the statement with two INNER JOINS but in some situations was getting an error so changed the last INNER JOIN to a LEFT OUTER JOIN (as...
1
by: Steve | last post by:
Hi, I am real new to databases and hoping someone can help. Main-table is a huge spreadsheet that I imported into Access Site-table has a bunch of addresses pulled from Main-table, quite a few...
6
by: dmonroe | last post by:
hi group -- Im having a nested inner join problem with an Access SQl statement/Query design. Im running the query from ASP and not usng the access interface at all. Here's the tables: ...
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
3
by: Zeff | last post by:
Hi all, I have a relational database, where all info is kept in separate tables and just the id's from those tables are stored in one central table (tblMaster)... I want to perform a query, so...
12
by: Chamnap | last post by:
Hello, everyone I have one question about the standard join and inner join, which one is faster and more reliable? Can you recommend me to use? Please, explain me... Thanks Chamnap
1
by: teneesh | last post by:
Here I have a code for a view that has been created by a developer on my team. I am trying to use the very same code to create a view for a different formid/quesid. But I cannot figure out how this...
2
by: MATTXtwo | last post by:
I have this store procedure to select data from table with join like this...SELECT tblPeribadi.Personel_No, tblPeribadi.Nama,tblCompany.Keterangan as Company_Code, tblPeribadi.Jawatan,...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.