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
record) But if I were to go to the record by typing in its
record number on the bottom, then it would work.
Here is the Code:
Option Compare Database
Private Sub Combo22_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Phone Number] = '" & Me![Combo22] & "'"
Me.Bookmark = rs.Bookmark
End Sub
Private Sub Combo31_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Ralphs Card #] = '" & Me![Combo31] & "'"
Me.Bookmark = rs.Bookmark
End Sub
Private Sub Combo33_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Phone Number] = '" & Me![Combo33] & "'"
Me.Bookmark = rs.Bookmark
End Sub
Private Sub Combo35_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Ralphs Card #] = '" & Me![Combo35] & "'"
Me.Bookmark = rs.Bookmark
End Sub
Private Sub Combo39_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Phone Number] = '" & Me![Combo39] & "'"
Me.Bookmark = rs.Bookmark
End Sub
Thank You
.. 4 4676
Have you tried requerying the Combo Box after adding the new record? Or, is
it the Form itself you mean -- try requerying the Form, if so.
You don't have any test in your code to determine if you did or did not find
a match... use the .NoMatch property of the recordset to make such a
determination... that would be one reason that you might be located to the
first record.
And, as you know that "rs" is, in fact, a DAO.Recordset, why would you Dim
it as an Object? And, a Form's RecordsetClone is simply one word... it is
not the .Clone property of the Form's Recordset property.
Try all these changes and if you still get relocated to the first record,
follow up with any more detail you can think of.
Larry Linson
Microsoft Access MVP
"Skully Matjas" <sk**********@yahoo.com> wrote in message
news:cc******************************@news.teranew s.com... 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 record) But if I were to go to the record by typing in its record number on the bottom, then it would work. Here is the Code:
Option Compare Database
Private Sub Combo22_AfterUpdate() ' Find the record that matches the control. Dim rs As Object
Set rs = Me.Recordset.Clone rs.FindFirst "[Phone Number] = '" & Me![Combo22] & "'" Me.Bookmark = rs.Bookmark End Sub Private Sub Combo31_AfterUpdate() ' Find the record that matches the control. Dim rs As Object
Set rs = Me.Recordset.Clone rs.FindFirst "[Ralphs Card #] = '" & Me![Combo31] & "'" Me.Bookmark = rs.Bookmark End Sub
Private Sub Combo33_AfterUpdate() ' Find the record that matches the control. Dim rs As Object
Set rs = Me.Recordset.Clone rs.FindFirst "[Phone Number] = '" & Me![Combo33] & "'" Me.Bookmark = rs.Bookmark End Sub
Private Sub Combo35_AfterUpdate() ' Find the record that matches the control. Dim rs As Object
Set rs = Me.Recordset.Clone rs.FindFirst "[Ralphs Card #] = '" & Me![Combo35] & "'" Me.Bookmark = rs.Bookmark End Sub
Private Sub Combo39_AfterUpdate() ' Find the record that matches the control. Dim rs As Object
Set rs = Me.Recordset.Clone rs.FindFirst "[Phone Number] = '" & Me![Combo39] & "'" Me.Bookmark = rs.Bookmark End Sub
Thank You .
Sorry, Skully, as a matter of practice, I do not open attachments to
newsgroup posts. No offense intended, but anyone who wanted to run some
malicious code could use the same approach. Also, it is considered bad
practice to attach files to post in newsgroups that don't have "binaries" in
the name because it can be costly for those who still pay by the minute for
their Internet connect time. (See http://www.mvps.org/access/netiquette.htm
for other good suggestions on using the newsgroup.)
The Combo Box Wizard has an option for using the Combo Box to select a
Record on the Form. Is that what you used? It generates code in the
AfterUpdate event of the Combo Box -- you might look at that to determine
whether you have in fact used enough fields to uniquely identify a parent.
Larry Linson
Microsoft Access MVP
"Skully Matjas" <sk**********@yahoo.com> wrote in message
news:64******************************@news.teranew s.com... Thank you for getting back to me. I am very new at this so i didnot understand what you said, here i will give as much cetails as possible:
1) The combo box i am using is combox39 2) I imported a a table of parents of a school (it has name,address,#, etc...) 3) I nead to input a ID Number (ralphs card) for some of the parents 4) The ID numbers do not go inorder of the parents, and i am not being handed the id numbers in order 4) I want to be able to select a parent from the combobox, it will then bring up that parent onto the form, where i could then enter the id
number. (I use the calender to record the date that i enterd the id number)
Problem: Some of the parents, when i click on thier name it does not
bring to their record. And also once I add the ID number, it puts thier name to the bottom of the combobox list eventhough In the table they are still in alphabetical order.
here Is a screenshoot of the form
"Larry Linson" <bo*****@localhost.not> wrote in news:Cq*******************@nwrddc01.gnilink.net:
Have you tried requerying the Combo Box after adding the new record? Or, is it the Form itself you mean -- try requerying the Form, if so.
You don't have any test in your code to determine if you did or did not find a match... use the .NoMatch property of the recordset to make such a determination... that would be one reason that you might be located to the first record.
And, as you know that "rs" is, in fact, a DAO.Recordset, why would you Dim it as an Object? And, a Form's RecordsetClone is simply one word... it is not the .Clone property of the Form's Recordset property.
Try all these changes and if you still get relocated to the first record, follow up with any more detail you can think of.
Larry Linson Microsoft Access MVP
"Skully Matjas" <sk**********@yahoo.com> wrote in message news:cc******************************@news.teranew s.com... 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 record) But if I were to go to the record by typing in its record number on the bottom, then it would work. Here is the Code:
Option Compare Database
Private Sub Combo22_AfterUpdate() ' Find the record that matches the control. Dim rs As Object
Set rs = Me.Recordset.Clone rs.FindFirst "[Phone Number] = '" & Me![Combo22] & "'" Me.Bookmark = rs.Bookmark End Sub Private Sub Combo31_AfterUpdate() ' Find the record that matches the control. Dim rs As Object
Set rs = Me.Recordset.Clone rs.FindFirst "[Ralphs Card #] = '" & Me![Combo31] & "'" Me.Bookmark = rs.Bookmark End Sub
Private Sub Combo33_AfterUpdate() ' Find the record that matches the control. Dim rs As Object
Set rs = Me.Recordset.Clone rs.FindFirst "[Phone Number] = '" & Me![Combo33] & "'" Me.Bookmark = rs.Bookmark End Sub
Private Sub Combo35_AfterUpdate() ' Find the record that matches the control. Dim rs As Object
Set rs = Me.Recordset.Clone rs.FindFirst "[Ralphs Card #] = '" & Me![Combo35] & "'" Me.Bookmark = rs.Bookmark End Sub
Private Sub Combo39_AfterUpdate() ' Find the record that matches the control. Dim rs As Object
Set rs = Me.Recordset.Clone rs.FindFirst "[Phone Number] = '" & Me![Combo39] & "'" Me.Bookmark = rs.Bookmark End Sub
Thank You .
"Larry Linson" <bo*****@localhost.not> wrote in
news:Nk******************@nwrddc03.gnilink.net:
Yes, I did use that, and i selected it to say first, and last naem (last
name first) I think That is pretty uniqe
So how come some records dont come up.
Also how come when i eddit records it puts them on the bottom of the
list. Is there extra code that I can input. If so please type in exactly
how i should do, as i am very new at this.
Thank you
P.S. Sorry about the attachments Sorry, Skully, as a matter of practice, I do not open attachments to newsgroup posts. No offense intended, but anyone who wanted to run some malicious code could use the same approach. Also, it is considered bad practice to attach files to post in newsgroups that don't have "binaries" in the name because it can be costly for those who still pay by the minute for their Internet connect time. (See http://www.mvps.org/access/netiquette.htm for other good suggestions on using the newsgroup.)
The Combo Box Wizard has an option for using the Combo Box to select a Record on the Form. Is that what you used? It generates code in the AfterUpdate event of the Combo Box -- you might look at that to determine whether you have in fact used enough fields to uniquely identify a parent.
Larry Linson Microsoft Access MVP
"Skully Matjas" <sk**********@yahoo.com> wrote in message news:64******************************@news.teranew s.com... Thank you for getting back to me. I am very new at this so i didnot understand what you said, here i will give as much cetails as possible:
1) The combo box i am using is combox39 2) I imported a a table of parents of a school (it has name,address,#, etc...) 3) I nead to input a ID Number (ralphs card) for some of the parents 4) The ID numbers do not go inorder of the parents, and i am not being handed the id numbers in order 4) I want to be able to select a parent from the combobox, it will then bring up that parent onto the form, where i could then enter the id number. (I use the calender to record the date that i enterd the id number)
Problem: Some of the parents, when i click on thier name it does not bring to their record. And also once I add the ID number, it puts thier name to the bottom of the combobox list eventhough In the table they are still in alphabetical order.
here Is a screenshoot of the form
"Larry Linson" <bo*****@localhost.not> wrote in news:Cq*******************@nwrddc01.gnilink.net:
> Have you tried requerying the Combo Box after adding the new > record? Or, is it the Form itself you mean -- try requerying the > Form, if so. > > You don't have any test in your code to determine if you did or did > not find a match... use the .NoMatch property of the recordset to > make such a determination... that would be one reason that you > might be located to the first record. > > And, as you know that "rs" is, in fact, a DAO.Recordset, why would > you Dim it as an Object? And, a Form's RecordsetClone is simply one > word... it is not the .Clone property of the Form's Recordset > property. > > Try all these changes and if you still get relocated to the first > record, follow up with any more detail you can think of. > > Larry Linson > Microsoft Access MVP > > > "Skully Matjas" <sk**********@yahoo.com> wrote in message > news:cc******************************@news.teranew s.com... >> 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 >> record) But if I were to go to the record by typing in its >> record number on the bottom, then it would work. >> Here is the Code: >> >> Option Compare Database >> >> Private Sub Combo22_AfterUpdate() >> ' Find the record that matches the control. >> Dim rs As Object >> >> Set rs = Me.Recordset.Clone >> rs.FindFirst "[Phone Number] = '" & Me![Combo22] & "'" >> Me.Bookmark = rs.Bookmark >> End Sub >> Private Sub Combo31_AfterUpdate() >> ' Find the record that matches the control. >> Dim rs As Object >> >> Set rs = Me.Recordset.Clone >> rs.FindFirst "[Ralphs Card #] = '" & Me![Combo31] & "'" >> Me.Bookmark = rs.Bookmark >> End Sub >> >> Private Sub Combo33_AfterUpdate() >> ' Find the record that matches the control. >> Dim rs As Object >> >> Set rs = Me.Recordset.Clone >> rs.FindFirst "[Phone Number] = '" & Me![Combo33] & "'" >> Me.Bookmark = rs.Bookmark >> End Sub >> >> Private Sub Combo35_AfterUpdate() >> ' Find the record that matches the control. >> Dim rs As Object >> >> Set rs = Me.Recordset.Clone >> rs.FindFirst "[Ralphs Card #] = '" & Me![Combo35] & "'" >> Me.Bookmark = rs.Bookmark >> End Sub >> >> Private Sub Combo39_AfterUpdate() >> ' Find the record that matches the control. >> Dim rs As Object >> >> Set rs = Me.Recordset.Clone >> rs.FindFirst "[Phone Number] = '" & Me![Combo39] & "'" >> Me.Bookmark = rs.Bookmark >> End Sub >> >> Thank You >> . >> > > >
Skully,
Do you read VBA code? If you do, click on the AfterUpdate event in the
properties for your Combo Box and you will find, I am certain, that although
it displays both the Last and First name, it only selects on the Last Name.
That is, it will select the first record it finds that matches the Last
name. So if you have Bob Jones, Sam Jones, and James Jones and they are in
the table in the order I have listed them, even though you click on Sam
Jones or James Jones, it will populate the form with Bob Jones because that
was the first Jones in the table. It's easy to add code to do the find on
both names, but it is specific to the names of the fields that you are
using.
Substitute the name of your combo box for cboN, and the names of your fields
for Last and First:
You'll likely see code
rs.FindFirst "[Last] = '" & Me![cboN] & "'
change it to
rs.FindFirst "[Last] = '" & Me![cboN] & "' AND [First] = '" &
Me![cboN].Column(1) & "'"
Have you done anything to enforce a specific order on the records you have
and are displaying? That is, is the Row Source of your ComboBox a Query with
sorting specified, or an SQL statement with an ORDER BY clause? By
definition, data in relational database tables is UNORDERED, and, in
practice, every recored _added_ in Accesss is added at the end. Revise your
Combo to use a Query or SQL statement as described above sorting on Last
Name and on First Name, then in the AfterUpdate event of the form, add a
statement to requery the combo box. Substitute the name of your combo for
cboN:
Me!cboN.Requery
but, be aware that this will alone will not do what you want -- you must use
a Row Source for the Combo Box that has a sort order, as described above.
If you don't understand what I'm suggesting, or if there is information I am
overlooking, please feel free to follow up here (but please don't repost the
same original question again to start a new thread, as you did before).
Larry Linson
Microsoft Access MVP
"Skully Matjas" <sk**********@yahoo.com> wrote in message
news:86******************************@news.teranew s.com... "Larry Linson" <bo*****@localhost.not> wrote in news:Nk******************@nwrddc03.gnilink.net:
Yes, I did use that, and i selected it to say first, and last naem (last name first) I think That is pretty uniqe
So how come some records dont come up.
Also how come when i eddit records it puts them on the bottom of the list. Is there extra code that I can input. If so please type in exactly how i should do, as i am very new at this.
Thank you
P.S. Sorry about the attachments
Sorry, Skully, as a matter of practice, I do not open attachments to newsgroup posts. No offense intended, but anyone who wanted to run some malicious code could use the same approach. Also, it is considered bad practice to attach files to post in newsgroups that don't have "binaries" in the name because it can be costly for those who still pay by the minute for their Internet connect time. (See http://www.mvps.org/access/netiquette.htm for other good suggestions on using the newsgroup.)
The Combo Box Wizard has an option for using the Combo Box to select a Record on the Form. Is that what you used? It generates code in the AfterUpdate event of the Combo Box -- you might look at that to determine whether you have in fact used enough fields to uniquely identify a parent.
Larry Linson Microsoft Access MVP
"Skully Matjas" <sk**********@yahoo.com> wrote in message news:64******************************@news.teranew s.com... Thank you for getting back to me. I am very new at this so i didnot understand what you said, here i will give as much cetails as possible:
1) The combo box i am using is combox39 2) I imported a a table of parents of a school (it has name,address,#, etc...) 3) I nead to input a ID Number (ralphs card) for some of the parents 4) The ID numbers do not go inorder of the parents, and i am not being handed the id numbers in order 4) I want to be able to select a parent from the combobox, it will then bring up that parent onto the form, where i could then enter the id number. (I use the calender to record the date that i enterd the id number)
Problem: Some of the parents, when i click on thier name it does not bring to their record. And also once I add the ID number, it puts thier name to the bottom of the combobox list eventhough In the table they are still in alphabetical order.
here Is a screenshoot of the form
"Larry Linson" <bo*****@localhost.not> wrote in news:Cq*******************@nwrddc01.gnilink.net:
> Have you tried requerying the Combo Box after adding the new > record? Or, is it the Form itself you mean -- try requerying the > Form, if so. > > You don't have any test in your code to determine if you did or did > not find a match... use the .NoMatch property of the recordset to > make such a determination... that would be one reason that you > might be located to the first record. > > And, as you know that "rs" is, in fact, a DAO.Recordset, why would > you Dim it as an Object? And, a Form's RecordsetClone is simply one > word... it is not the .Clone property of the Form's Recordset > property. > > Try all these changes and if you still get relocated to the first > record, follow up with any more detail you can think of. > > Larry Linson > Microsoft Access MVP > > > "Skully Matjas" <sk**********@yahoo.com> wrote in message > news:cc******************************@news.teranew s.com... >> 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 >> record) But if I were to go to the record by typing in its >> record number on the bottom, then it would work. >> Here is the Code: >> >> Option Compare Database >> >> Private Sub Combo22_AfterUpdate() >> ' Find the record that matches the control. >> Dim rs As Object >> >> Set rs = Me.Recordset.Clone >> rs.FindFirst "[Phone Number] = '" & Me![Combo22] & "'" >> Me.Bookmark = rs.Bookmark >> End Sub >> Private Sub Combo31_AfterUpdate() >> ' Find the record that matches the control. >> Dim rs As Object >> >> Set rs = Me.Recordset.Clone >> rs.FindFirst "[Ralphs Card #] = '" & Me![Combo31] & "'" >> Me.Bookmark = rs.Bookmark >> End Sub >> >> Private Sub Combo33_AfterUpdate() >> ' Find the record that matches the control. >> Dim rs As Object >> >> Set rs = Me.Recordset.Clone >> rs.FindFirst "[Phone Number] = '" & Me![Combo33] & "'" >> Me.Bookmark = rs.Bookmark >> End Sub >> >> Private Sub Combo35_AfterUpdate() >> ' Find the record that matches the control. >> Dim rs As Object >> >> Set rs = Me.Recordset.Clone >> rs.FindFirst "[Ralphs Card #] = '" & Me![Combo35] & "'" >> Me.Bookmark = rs.Bookmark >> End Sub >> >> Private Sub Combo39_AfterUpdate() >> ' Find the record that matches the control. >> Dim rs As Object >> >> Set rs = Me.Recordset.Clone >> rs.FindFirst "[Phone Number] = '" & Me![Combo39] & "'" >> Me.Bookmark = rs.Bookmark >> End Sub >> >> Thank You >> . >> > > > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dan |
last post by:
Hello,
I am trying to read and write to an Excel file via my Java applet. I
have done so successfully on several simple Excel files that simply
had data cells without many complicated equations...
|
by: Jim |
last post by:
I need some help getting started with a .NET web project for a
commercial site. I am new to .NET and my understanding of some (but
not all) of its concepts is a little sparse. I apologize for the...
|
by: Skully Matjas |
last post by:
Thank you for getting back to me. I am very new at this so i didnot
understand what you said, here i will give as much cetails as possible:
1) The combo box i am using is combox39
2) I imported...
|
by: Dom Boyce |
last post by:
Hi
First up, I am using MS Access 2002.
I have a database which records analyst rating changes for a list of
companies on a daily basis. Unfortunately, the database has been set
up (by my...
|
by: Earthling |
last post by:
Any help would be appreciated to solve the following simple problem that
I will describe.
***
There is a form called "red chocolate form".
The form has a particular subform field that has a...
|
by: alwayshouston |
last post by:
Hi All!
I am working on this very small database and I am confused in the
designing a simple form. I only have three tables in the database.
First Table: tblExpense
Columns: ExpenseID ;...
|
by: Nelson |
last post by:
Hi,
I'm trying to design a simple database in which I can keep track of the
amount of time my 5 technicians spend on various jobs.
At the start and end of each particular job (could be 5...
|
by: HydroPnik |
last post by:
Hi all! What a great community you have here. Being an Access newbie I have already used much information gleaned from the other posters for my current project.
I have been tasked with creating a...
|
by: djjohnst |
last post by:
I am creating a program that will list program times for people who
visit our website. Users can login create, edit, delete a program.
These dump into a database. The ASP webpage then reads from...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
|
by: SueHopson |
last post by:
Hi All,
I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...
| |