Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 6th, 2003, 03:37 AM
nono270980 nono270980 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 69 nono270980 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
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

Reply With Quote
  #2  
Old November 6th, 2003, 10:23 AM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
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-

Reply With Quote
  #3  
Old November 6th, 2003, 07:12 PM
nono270980 nono270980 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 69 nono270980 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
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

Reply With Quote
  #4  
Old November 7th, 2003, 12:17 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
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-

Reply With Quote
  #5  
Old November 7th, 2003, 07:19 PM
nono270980 nono270980 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 69 nono270980 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 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

Reply With Quote
  #6  
Old November 9th, 2003, 11:34 AM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
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-

Reply With Quote
  #7  
Old November 9th, 2003, 07:07 PM
nono270980 nono270980 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 69 nono270980 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
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

Reply With Quote
  #8  
Old November 9th, 2003, 09:01 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
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-

Reply With Quote
  #9  
Old November 9th, 2003, 09:47 PM
nono270980 nono270980 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 69 nono270980 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
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

Reply With Quote
  #10  
Old November 9th, 2003, 10:02 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Then instead of using ME use the name of the subform object

subformobjectName.requery

S-

Reply With Quote
  #11  
Old November 10th, 2003, 03:45 AM
nono270980 nono270980 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 69 nono270980 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
hi,

as u have said, requery is to refresh so how do i check if there is records in the main form??

nono

Reply With Quote
  #12  
Old November 10th, 2003, 08:13 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Quote:
Originally posted by sbaxter

select Count(FieldName) as RecordCount from QueryNAme


'then check for number of records

if rs.("RecordCount") = 0 then

Msgbox "No records selected"

Endif
S- [/B]


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

Reply With Quote
  #13  
Old November 10th, 2003, 09:15 PM
nono270980 nono270980 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 69 nono270980 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
hi,

your method works! thanks!

cheers
nono

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > search with text box


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 20