problem in performing search

deepakaa
01-15-2004, 06:28 AM
i m making a search engine which will search in two tables of database...
and will display result in excel sheet...

i have put two check boxes to ask users in which table they want to search...they can select any one or both....

search result from tabel one name "recevoi" will be displayed in sheet1 and that from table two named "envoi" will be displayed in sheet2 if both the check boxes r checked...if only anyone of them is checked then results will be in sheet1

the code is as given below...

'**************________

If chkrecevoisearch.Value = vbChecked Then

'sql query.....

If Not (adorecordset_recevoi.BOF) And Not (adorecordset_recevoi.EOF) Then

Set objXL = CreateObject("Excel.Application")
Set objXLBook = objXL.Workbooks.Add
Set objXLSheet = objXLBook.Worksheets(1)
......
else

Else
MsgBox "No records found in recevoi"
records = 1

'*****************__________

If chkenvoisearch.Value = vbChecked And chkrecevoisearch.Value = vbChecked Then

'sql query....

If Not (adorecordset_envoi.BOF) And Not (adorecordset_envoi.EOF) Then

If records <> 1 Then
Set objXLSheet = objXLBook.Worksheets(2) '.....error here
Else
Set objXLSheet = objXLBook.Worksheets(1)
End If
....
else

MsgBox "No records found in envoi"

end if

'***********_________

If chkenvoisearch.Value = vbChecked And chkrecevoisearch.Value = vbUnchecked Then

'sql query.....

If Not (adorecordset_envoi.BOF) And Not (adorecordset_envoi.EOF) Then


Set objXL = CreateObject("Excel.Application")
Set objXLBook = objXL.Workbooks.Add
Set objXLSheet = objXLBook.Worksheets(1)
....
else

MsgBox "No records found in envoi"

end if
'***************************************************

now the criteria to perform search can be selected from the combobox..and the value of that criteria can be selected from another combobox or if they want to perform a random search they have to write one word in a text box....

it works good when user select criteria and value from the combobox..but it fails when user wants to perform a random search and shows error where i have marked 'error here' in above code.....

and it only shows error when user wants to perform random search in table two named "envoi" it works good with the random search in first table...

and the another bizzare thing is that it shows error in the that perticular statement even when the if condition,in which it is writtten, is wrong

pls tell me what is the problem and how to solve it...

deepakaa
01-15-2004, 06:35 AM
the error i get is "execution error no 91"....."Variable object or variable bloc With not defined"...

Dennis DVR
01-15-2004, 06:39 AM
what part of the code is causing error?

deepakaa
01-15-2004, 06:43 AM
its marked with bold letters...

deepakaa
01-15-2004, 07:07 AM
:confused: ....pls reply friends...i m struck with really a bizzare problem...cant understand what to do..

deepakaa
01-15-2004, 09:17 AM
why no one is replying..m i clear enough with my problem.....if not, pls tell...

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum