473,791 Members | 2,853 Online
Bytes | Software Development & Data Engineering Community
+ 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...her e 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 1686
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.RecordsetClo ne
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******@rehab management.com> wrote in message
news:39******** *************** ***@posting.goo gle.com...
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...her e 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.RecordsetClo ne
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.solco n.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.RecordsetClo ne
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
4763
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 onto the bottom of the list (even though it keeps its record number). Also, There are certin names that i click on the list, and it will not bring it up, rather it brings to the first record (no matter how many times i try going to that...
5
4335
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 child table (StudentProgress). The course progress records how a student progresses on a course. I have one course (History) and one student called Maya. I now want to record her grade (64). If I do this in Access using a form, then the form...
2
6164
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 on my form contains a category ID (bound column, not visible, long integer) for the items listed on the form and a description (unbound column, visible, string.) I can "Sort Ascending" and "Sort Descending" on the visible description in the...
19
4110
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 the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can easily understand a newbie using bound controls or someone with a tight deadline. I guess I need...
4
3175
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. Tables: (abbreviated) TblDivision DivisionID
8
6816
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 be filled in, one of which is a date field. right now, i've been using this db myself and have entered only 10 days of sample data to check my calculations but i realized that there may be times when i need to add a record that was missed that...
16
3502
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 in a hidden field) I wish the user to be able to edit the data in the table, so I have extracted the records into hiddenfield, textareas, dropdown list and checkbox so that they can make changes. I named these elements as arrays and wish to run an...
2
2093
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 that'll indicate status (e.g. a checked box could mean married/single, >40 or <40 etc.). I'd like to write data to this table - for example if I check or uncheck a box, a "YES" or "NO" should be written to that particular field in the table. I'd also...
1
4030
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 are not bound, I select from the bottom set and add to the top set which works fine, but now i decide to remove an item from the top set. when i tried to use a remove item code it worked fine, it did delete the item form the list but it added...
0
9669
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9515
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10207
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10154
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4109
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 we have to send another system
2
3713
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2913
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.