Can This possible (1 Viewer)

puthenveetil

Registered User.
Local time
Tomorrow, 03:11
Joined
Aug 9, 2004
Messages
94
Hi all

I had a query and the sql is

SELECT Institutions.*, Institutions.merge, Institutions.Inst_type
FROM Institutions
WHERE (((Institutions.merge)=True) AND ((Institutions.Inst_type)=[forms]![merge_inst_type]![Inst_type]));


and I had a command button which process

MergeAllWord ("select * from merge_query_true")

but I am getting an error like this "make sure the sql is correct , sql was
select * from merge_query_true

If I had cut the part "AND ((Institutions.Inst_type)=[forms]![merge_inst_type]![Inst_type])); from the sql it works fine....

I like the query to search both fields... Can this be done...


Thanks in advance

Thanks
 

puthenveetil

Registered User.
Local time
Tomorrow, 03:11
Joined
Aug 9, 2004
Messages
94
Hi,

yes, it is opened.
 

krunalprajapati

Registered User.
Local time
Tomorrow, 03:11
Joined
Dec 15, 2004
Messages
101
change your query
and write down [forms]![merge_inst_type].[Inst_type] instead of
[forms]![merge_inst_type]![Inst_type].

the change is u have write ! before [Inst_type].
put . instead of ! before [Inst_type].
 

puthenveetil

Registered User.
Local time
Tomorrow, 03:11
Joined
Aug 9, 2004
Messages
94
Hi Krunal

thanks for the reply, I had tried your suggestion still same error message.

The query works fine . I had to tried to send the results to a form and it is working ok But when i try to use this one

select * from merge_query_true

then it fails....is that code ok or I had to make any change...I am not a expert in sql so I am compleately lost....



Thanks
 

puthenveetil

Registered User.
Local time
Tomorrow, 03:11
Joined
Aug 9, 2004
Messages
94
Hi ,

This is the code which uses that sql

Dim strDirPath As String ' full path name to working dir
Dim OneField As DAO.Field ' dao code
Dim strFields As String
Dim strData As String
Dim intFile As Integer

Dim rstOutput As DAO.Recordset
Dim strOutFile As String ' csv file output name

On Error GoTo exit2 ' if sql is bad...simply exit...

Set rstOutput = CurrentDb.OpenRecordset(strSql)


If rstOutput.RecordCount = 0 Then
' no records...exit.
GoTo exit1
End If

exit2:

MsgBox "No data was created for this merge" & vbCrLf & _
"Make sure the sql is correct" & vbCrLf & _
"sql was " & vbCrLf & vbCrLf & strSql, _
vbCritical, "no data for this merge"


any one had any idea

thanks
 

krunalprajapati

Registered User.
Local time
Tomorrow, 03:11
Joined
Dec 15, 2004
Messages
101
the SQL u written is true.
but what is MergeAllWord ("select * from merge_query_true")?
is it a function?
and what is merge_query_true?
what fields it contains?
give the full details of table and ur function.
 

Users who are viewing this thread

Top Bottom