|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
search with text box
hi,
i have a form that has an unbound field where it is the search criteria. when the user enter the text field, it will retrieve the records under this criteria specify. i am not very sure about recordset/recordsource......... how can i do that??? pls guide me along. pls advice nono |
|
#2
|
|||
|
|||
|
Is your entire form unbound, or do you have a control you are passing the recordset to, that the rest of you text boxes are bound to?
S- |
|
#3
|
|||
|
|||
|
hi,
only my textbox is unbound, the others are based on a query. so how can i retireve the records???? i am using access 2000. pls advice nono |
|
#4
|
|||
|
|||
|
If I understand you correctly, You have a text box that is tied to a query (as a parameter of the query) and the other text boxes on the form are bound directly for the results of the query.
if this is the case in the Afterupdate event of the textbox in question put this [formName].requery Now I could be misunderstanding so please clarify the logic if I am wrong, S- |
|
#5
|
|||
|
|||
|
hi,
please guide me on how can i do that. my query is meant for my forms fields(those that are not entered by user.) user only have one text box where the user can enter the search criteria and based on the search criteria , it retrieve the records. how am i going to do that??? i do not know how to start and where to start. pls guide nono |
|
#6
|
|||
|
|||
|
Just create you bounded form (based on you query) like you would normally, add the text box for your search criteria and in the After_Update event of the search criteria text box add the following
ME.requery S- |
|
#7
|
|||
|
|||
|
hi,
can i don't use the method - me.requery?? becoz i wanted to check if there is no records, display a error msgbox. but with me.requery i do not know how can i check for empty records. that is y i wanted to use something like recordset .... recordsource....... how can i go about doing it??? pls advice nono |
|
#8
|
|||
|
|||
|
all the "me.requery" does is tell the query that the form is bound to the refresh itself. If there is no record in the recordset nothing will show up in the other fields, but is you want a to tell the use the haven't selected anything. then add code to the after_update event the opens the query using either DAO or ADO with a SQL statement of
select Count(FieldName) as RecordCount from QueryNAme 'then check for number of records if rs.("RecordCount") = 0 then Msgbox "No records selected" Endif S- |
|
#9
|
|||
|
|||
|
hi,
i have found some error that i have made in telling you. my main form actually consist of a subform where ONLy the subform is based on the query. the main form i actually make use of the select statement to retrieve the records, which means i wrote the select statement myself at the record source under the data properties. so how do i check now???? i cannot use the method u have taught me above as the main form doesnot depends on a query. pls advice nono |
|
#10
|
|||
|
|||
|
Then instead of using ME use the name of the subform object
subformobjectName.requery S- |
|
#11
|
|||
|
|||
|
hi,
as u have said, requery is to refresh so how do i check if there is records in the main form?? nono |
|
#12
|
|||
|
|||
|
Quote:
Put the following CODE in the After_Updated Event DIm db as database DIm rs as DAO.recordset DIm s as string s = "select Count(FieldNameFromQuery) as RecordCount from QueryNAme" Set db = currentDB() Set rs = OpenDatabase(s) 'then check for 0 records if rs.EOF then Msgbox "No records selected" Endif For the above code to work you need to add the following reference Microsoft DAO #### Object Library by doing the following In the Debug window: Select Tools, references, Then find the above library |
|
#13
|
|||
|
|||
|
hi,
your method works! thanks! cheers nono |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > search with text box |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|