473,473 Members | 2,163 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

using Find property in a form to locate records in a table

I am trying to create a data entry form for my database that will
enable a user to add a new record or alter an existing record in the
table all on one form. So far, the form is set up to display the
records of the table in text boxes at the bottom, and I can scroll
thru the records, and a button("Add A New Patient") will allow the
user to go to the end of the table and enter data. The other button
("Find A Patient") has been more difficult...here is the code I have
so far:

Private Sub Command42_Click()
Dim rs As Object
Set rs = Me.Recordset

rs.Filter = "[LastName] = '" & (Me!Text38) & "' and [FacilityCode] =
'" & (Me!Text40) & "'"

End Sub

I want the user to input the last name and facility code of the
record they are trying to update, and have the form display that
record. The problem is that when I run this, the record I want does
not show up in the text boxes at the bottom of the form.
Can anybody help a beginner with this?
Thanks!

Christine
Nov 12 '05 #1
4 1669
Christine wrote:
Private Sub Command42_Click()
Dim rs As Object
Set rs = Me.Recordset

rs.Filter = "[LastName] = '" & (Me!Text38) & "' and [FacilityCode] =
'" & (Me!Text40) & "'"

End Sub

The problem is that when I run this, the record I want does
not show up in the text boxes at the bottom of the form.


What happens if you use Me.Filter instead of rs.Filter? Don't forget to
do Me.Filteron = True (that helps)

--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #2
Off the top of my head, maybe this will work?

Private Sub Command42_Click()
Dim rs As Recordset

Set rs = Me.RecordsetClone
rs.FindFirst "[LastName] = '" & (Me!Text38) & "' and [FacilityCode] = '" &
(Me!Text40) & "'"
If rs.NoMatch = False Then
Me.BookMark = rs.BookMark
Else
MsgBox "Entry not found"
End IF

End Sub

Mike Storr
www.veraccess.com

"Christine" <cb******@rehabmanagement.com> wrote in message
news:39**************************@posting.google.c om...
I am trying to create a data entry form for my database that will
enable a user to add a new record or alter an existing record in the
table all on one form. So far, the form is set up to display the
records of the table in text boxes at the bottom, and I can scroll
thru the records, and a button("Add A New Patient") will allow the
user to go to the end of the table and enter data. The other button
("Find A Patient") has been more difficult...here is the code I have
so far:

Private Sub Command42_Click()
Dim rs As Object
Set rs = Me.Recordset

rs.Filter = "[LastName] = '" & (Me!Text38) & "' and [FacilityCode] =
'" & (Me!Text40) & "'"

End Sub

I want the user to input the last name and facility code of the
record they are trying to update, and have the form display that
record. The problem is that when I run this, the record I want does
not show up in the text boxes at the bottom of the form.
Can anybody help a beginner with this?
Thanks!

Christine

Nov 12 '05 #3
Mike Storr wrote:
Off the top of my head, maybe this will work?

Private Sub Command42_Click()
Dim rs As Recordset

Set rs = Me.RecordsetClone
rs.FindFirst "[LastName] = '" & (Me!Text38) & "' and [FacilityCode] = '" &
(Me!Text40) & "'"
If rs.NoMatch = False Then
Me.BookMark = rs.BookMark
Else
MsgBox "Entry not found"
End IF

End Sub

Mike Storr
www.veraccess.com


I like that better than whan I suggested; the Filter approach leaves you
with a shrunken dataset (only the record you looked for) and yours only
moves the 'cursor'.

--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #4
Thanks. I personnaly hate using filters, like you said they just shrink the
display instead of actually making what you want active. They're ok for
reports, but find them to be a nuissance in forms.
"Bas Cost Budde" <ba*@heuveltop.org> wrote in message
news:c0***********@news2.solcon.nl...
Mike Storr wrote:
Off the top of my head, maybe this will work?

Private Sub Command42_Click()
Dim rs As Recordset

Set rs = Me.RecordsetClone
rs.FindFirst "[LastName] = '" & (Me!Text38) & "' and [FacilityCode] = '" & (Me!Text40) & "'"
If rs.NoMatch = False Then
Me.BookMark = rs.BookMark
Else
MsgBox "Entry not found"
End IF

End Sub

Mike Storr
www.veraccess.com


I like that better than whan I suggested; the Filter approach leaves you
with a shrunken dataset (only the record you looked for) and yours only
moves the 'cursor'.

--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #5

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

Similar topics

4
by: Skully Matjas | last post by:
I am using the following code (created by the wizard) to allow to bring my form to a particular entery. But when I edit the entery (ex: put new information into a blank cell), it puts that record...
5
by: Ilan Sebba | last post by:
When it comes to adding records in related tables, Access is really smart. But when I try to do the same using ADO, I am really stupid. Say I have two parent tables (eg Course, Student) and one...
2
by: Todd | last post by:
Hello, I'm curious if anyone knows of a way (if one exists) to tell a form (in Access 2002 VBA) to sort on an unbound column of a combo box on the form. Here's what I want to do: A combo box...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
4
by: Kathy | last post by:
What is the standard technique for handling the fields in the following scenario on a continuous form? Multiple Divisions. Each Division has multiple Buildings. Each Building has a Supervisor. ...
8
by: kaosyeti | last post by:
i have a (hopefully) small problem. i have created a system where a user enters customer information into a table through a form. this table has no primary key. there are 9 fields on the form to...
16
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record...
2
by: Oxy | last post by:
Hi all, I have a pre-defined table with several fields. I'm trying to create a form that'll have a drop down list showing several records (e.g.names from the table) and several check boxes...
1
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
1
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: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.