473,382 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Find Record mataching 3 criteria Fields

I am trying to create a form to make it easier to modify a record
without having to page through all the records. I have started the
form with 3 cascading combo boxes. ie #1 asks for division , #2 is
populated with just the customers in the division specified by #1 and
then #3 is just the Parts for the customer in #2. This part works
great. I now need to set the code in the after update of the #3 combo
box to pull up the record that goes with this data by using the choices
of the 3 combo boxes.

Here is the code that I have but it is bombing out on the
"myset.FindFirst" statement, with a error Compile Error - Methode or
Data Member not found.

Any help is greatly appreciated.

Private Sub Part_Number_Sel_cbo_AfterUpdate()
Dim myset As Recordset
Dim strSearchDivison As String
Dim strSearchCustomer As String
Dim strSearchPart As String
Set myset = Me.RecordsetClone
strSearchDivsion = Me!Divison_Sel_cbo.Value
strSearchCustomer = Me!Customer_Sel_cbo.Value
strSearchPart = Me!Part_Number_Sel_cbo.Value
myset.FindFirst "[Divison] = '" & strSearchDivison & "' and
[Customer] = '" & strSearchCustomer & "' and [Part Number] = '" &
strSearchPart & "'"
Me.Bookmark = myset.Bookmark
Thank you,

Darren

Nov 13 '05 #1
5 5030
"ddecoste" <dd******@yahoo.com> wrote
I am trying to create a form to make it easier to modify a record
without having to page through all the records. I have started the
form with 3 cascading combo boxes. ie #1 asks for division , #2 is
populated with just the customers in the division specified by #1 and
then #3 is just the Parts for the customer in #2. This part works
great. I now need to set the code in the after update of the #3 combo
box to pull up the record that goes with this data by using the choices
of the 3 combo boxes.

Here is the code that I have but it is bombing out on the
"myset.FindFirst" statement, with a error Compile Error - Methode or
Data Member not found.

Any help is greatly appreciated.

Private Sub Part_Number_Sel_cbo_AfterUpdate()
Dim myset As Recordset
Dim strSearchDivison As String
Dim strSearchCustomer As String
Dim strSearchPart As String
Set myset = Me.RecordsetClone
strSearchDivsion = Me!Divison_Sel_cbo.Value
strSearchCustomer = Me!Customer_Sel_cbo.Value
strSearchPart = Me!Part_Number_Sel_cbo.Value
myset.FindFirst "[Divison] = '" & strSearchDivison & "' and
[Customer] = '" & strSearchCustomer & "' and [Part Number] = '" &
strSearchPart & "'"
Me.Bookmark = myset.Bookmark


Is either [Divison] or [Part Number] numeric? You have them in single
quotes. If the query is looking for a numeric value, do away with the
single quotes.

Is this ADO code? Because ADO does not have a FindFirst method. Is it code
in an Access 2000+ mdb - because it defaults to ADO. Try changing this
line:

Dim myset As Recordset

to

Dim myset As DAO.Recordset
Darryl Kerkeslager


Nov 13 '05 #2
ddecoste wrote:
I am trying to create a form to make it easier to modify a record
without having to page through all the records. I have started the
form with 3 cascading combo boxes. ie #1 asks for division , #2 is
populated with just the customers in the division specified by #1 and
then #3 is just the Parts for the customer in #2. This part works
great. I now need to set the code in the after update of the #3 combo
box to pull up the record that goes with this data by using the choices
of the 3 combo boxes.

Here is the code that I have but it is bombing out on the
"myset.FindFirst" statement, with a error Compile Error - Methode or
Data Member not found.

Any help is greatly appreciated.

Private Sub Part_Number_Sel_cbo_AfterUpdate()
Dim myset As Recordset
Dim strSearchDivison As String
Dim strSearchCustomer As String
Dim strSearchPart As String
Set myset = Me.RecordsetClone
strSearchDivsion = Me!Divison_Sel_cbo.Value
strSearchCustomer = Me!Customer_Sel_cbo.Value
strSearchPart = Me!Part_Number_Sel_cbo.Value
myset.FindFirst "[Divison] = '" & strSearchDivison & "' and
[Customer] = '" & strSearchCustomer & "' and [Part Number] = '" &
strSearchPart & "'"
Me.Bookmark = myset.Bookmark
Thank you,

Darren


I get that message when I search on a field and the name of the field on
the form is incorrect. Ex:
rst.FindFirst "ID= '" & Me.ID1 & "'"
and there is no ID1.

If I did
rst.FindFirst "ID1 = '" & Me.ID & "'"
and ID1 did not exist in the recordset, but ID did, I'd get a message
that the object was not found.

WHere is it blowing up? On the findfirst line or one of the lines your
are assigning values?

I could click the vertical bar to the left on
strSearchDivsion = Me!Divison_Sel_cbo.Value
and then run the form and step thru your code.

Nov 13 '05 #3
Thank you for the input.

All three of the of the fields that I am using (Division, Part Number
and Customer) in the query are strings.

This is being done in Access 2002. I did try to change the declaration
of the recordset from:

Dim myset as Recordset
to
Dim myset as DAO.Recordset

When I then try the code it bottoms out on the changed line of
Dim myset as DAO.Recordset. With an error of Compile Error:
User-defined type not defined.

Any other ideas? or is there an easier way of doing this??
Thank you for the help.

Nov 13 '05 #4
I double checked and the field names are correct, these are just some
unbound combo boxes doing a cascading lookup on the database.

The place that it bottoms out is the .FindFirst statement during the
compile. It does not even make it to the running of the code..

Any other suggestions.

Thank you for all your help also. If an easier way is possible please
let me know.

Thank you,

Nov 13 '05 #5
Thank you Darryl and Salad for your help.

After doing a bunch more research and looking at what you told me I
did get it to work.

1st: I am a horrible speller and I had spelled my field name wrong in
the database and all the references to it. Salad, you hit that one ( I
dont know how to spell division) Damm computer wants the correct
spelling what gives:)
2nd. Under Tools, references in Access I did not have the DAO
selected. After searching on the error codes that I received after
changing the declaration, I found the article on changing the
references to include the DAO.

Thank you both for your help.

Darren

Nov 13 '05 #6

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

Similar topics

6
by: John | last post by:
Hi, I have simple database based on 3 tables. Relationship is 'one to many' between table 1 and 2, also between 2 and 3 table'one to many'. I have made form where I enter data in all 3 tables....
3
by: Tom Mitchell | last post by:
All: I'm stumped on a query. How do I find duplicates in a table where one of the duplicates has values is a certain field and the other doesn't. For example, I have the following table: ...
2
by: Neil Ginsberg | last post by:
I have a client using an Access 2002 front end and back end. A certain record wasn't showing up in several reports. He sent me the back end (I have the same front on my machine), and I ran the...
8
by: jquest | last post by:
Hi Again; I have had help from this group before and want to thank everyone, especially PCDatasheet. My database includes a field called HomePhone, it uses the (xxx)xxx-xxx format to include...
4
by: kufre | last post by:
How can I use three criteria to find a record? I've done this before where I only use one criteria to find a record and set the focus to that criteria only. Thanks in advance.
3
by: kaosyeti | last post by:
i need to do a record search in a form but there are a few twists. 1. there is no unique field to any of these records 2. the form has 9 fields, 5 of which are required for creating a record. 3....
6
by: MLH | last post by:
When the vehicle entry form (frmVehicleEntryForm) first opens, the additional owner SubForm control (frmAddnlOwnrListSubForm) is enabled. You can click on it and it will accept the focus. But after...
1
by: emmaruwa | last post by:
I have a form with two text boxes (in its details section) that pull data from two fields in my database table. This same form also has a button beside the text boxes which is supposed to open...
3
by: igendreau | last post by:
I'm trying to clean up a database of mine, and I need to convert some old DAO code over to ADO. When I was using DAO, I had no problem running this script and deleting the record using rs.Delete. ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.