473,395 Members | 1,484 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,395 software developers and data experts.

Findfirst + multiple criteria ???

Hey, this is the situation. I have imported a table from Excel and
know i must edit the saldo in the corresponding records tbl_Lignes.

Impdata tbl_Lignes
...................... ...................
File_nr Product saldo Dos_nr Line_nr saldo
-------- -------- ------ ------- ------- -----
123456 1 10 123456 1 ..
2 70 2 ..
3 65 3 ..
123457 1 50 123457 1
123458 1 40 123458 1
2 20 2

I loop through the Imptable and want to search the similar File nr
with the corresponding product nr in the tbl_Lignes and this with a
Findfirst.

I have wrote this and gives no errors but he doesn't find the
corresponding record.

......
......
Do While Not rstImpdata.EOF
strSeek = ""
strSeekDos = rstImpdata![File_nr]
strSeek = "Dos_nr = '" & strSeekDos & "'"
If (strSeek = strVgl) Then

With rstLignes
strLnr = ""
strLnr = rstLignes![Line_nr]

strSeek1 = "Dossier_Id = '" & strSeek & "' AND Ligne_Num = '" & strLnr
& "'"

.FindFirst strSeek1
!!!'HE DOESN'T FIND FILE_NR 123456 WITH Product 1 IN tbl_Lignes!!!!

If .NoMatch Then
MsgBox "No Ligne found in tbl_Ligne for " & strSeek1 &
"."
Else
.Edit
rstLignes![saldo] = rstImpdata![saldo]
.Update
.MoveNext
End If
End With
Else
.....
.....

What is wrong?? I' don't know it anymore.
Nov 13 '05 #1
2 4272
an*******@hotmail.com (@ndy) wrote in message news:<6c*************************@posting.google.c om>...
Hey, this is the situation. I have imported a table from Excel and
know i must edit the saldo in the corresponding records tbl_Lignes.

Impdata tbl_Lignes
..................... ...................
File_nr Product saldo Dos_nr Line_nr saldo
-------- -------- ------ ------- ------- -----
123456 1 10 123456 1 ..
2 70 2 ..
3 65 3 ..
123457 1 50 123457 1
123458 1 40 123458 1
2 20 2

I loop through the Imptable and want to search the similar File nr
with the corresponding product nr in the tbl_Lignes and this with a
Findfirst.

I have wrote this and gives no errors but he doesn't find the
corresponding record.

.....
.....
Do While Not rstImpdata.EOF
strSeek = ""
strSeekDos = rstImpdata![File_nr]
strSeek = "Dos_nr = '" & strSeekDos & "'"
If (strSeek = strVgl) Then

With rstLignes
strLnr = ""
strLnr = rstLignes![Line_nr]

strSeek1 = "Dossier_Id = '" & strSeek & "' AND Ligne_Num = '" & strLnr
& "'"

.FindFirst strSeek1
!!!'HE DOESN'T FIND FILE_NR 123456 WITH Product 1 IN tbl_Lignes!!!!

If .NoMatch Then
MsgBox "No Ligne found in tbl_Ligne for " & strSeek1 &
"."
Else
.Edit
rstLignes![saldo] = rstImpdata![saldo]
.Update
.MoveNext
End If
End With
Else
.....
.....

What is wrong?? I' don't know it anymore.


I have the same problem!!
Nov 13 '05 #2
On 30 Nov 2004 02:31:28 -0800, an*******@hotmail.com (@ndy) wrote:

In strSeek you're calling the first field Dossier_Id, whereas in your
table example you're calling it Dos_nr. Same with Ligne_Num and
Line_nr.

The quotes around the values are only correct if these are text
fields. If they really only can contain numbers, convert them to
numeric.

Text fields sometimes have leading or trailing spaces, so be careful
when looking for the exact string "1" where you may have "1 " in the
table.

Nothing you have shown in this example couldn't be done with an Update
query, in a fraction of the time.

-Tom.

Hey, this is the situation. I have imported a table from Excel and
know i must edit the saldo in the corresponding records tbl_Lignes.

Impdata tbl_Lignes
..................... ...................
File_nr Product saldo Dos_nr Line_nr saldo
-------- -------- ------ ------- ------- -----
123456 1 10 123456 1 ..
2 70 2 ..
3 65 3 ..
123457 1 50 123457 1
123458 1 40 123458 1
2 20 2

I loop through the Imptable and want to search the similar File nr
with the corresponding product nr in the tbl_Lignes and this with a
Findfirst.

I have wrote this and gives no errors but he doesn't find the
corresponding record.

.....
.....
Do While Not rstImpdata.EOF
strSeek = ""
strSeekDos = rstImpdata![File_nr]
strSeek = "Dos_nr = '" & strSeekDos & "'"
If (strSeek = strVgl) Then

With rstLignes
strLnr = ""
strLnr = rstLignes![Line_nr]

strSeek1 = "Dossier_Id = '" & strSeek & "' AND Ligne_Num = '" & strLnr
& "'"

.FindFirst strSeek1
!!!'HE DOESN'T FIND FILE_NR 123456 WITH Product 1 IN tbl_Lignes!!!!

If .NoMatch Then
MsgBox "No Ligne found in tbl_Ligne for " & strSeek1 &
"."
Else
.Edit
rstLignes![saldo] = rstImpdata![saldo]
.Update
.MoveNext
End If
End With
Else
.....
.....

What is wrong?? I' don't know it anymore.


Nov 13 '05 #3

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

Similar topics

5
by: Mike | last post by:
Hi I've written a module to find the first occurrence of a record in a query (that is my forms datasource) that matches four specified criteria. No matter what I try it doesn't seem to find ...
5
by: Paul | last post by:
The 2 statements below work perfectly when using them individually. But when I try to concatenate them, they don't. rst.FindFirst " = " & OldQuoteNumber rst.FindFirst " Is Null" Can someone...
4
by: psydork | last post by:
My first time to this group so please be kind. Anyway I have this questionnaire that has two parts (2 tables). I created a form for each of the tables and I am trying to make it so that when I...
1
by: jphelan | last post by:
I ran a MS Access Analyzer program that suggested changing, "rst.FindFirst strcriteria" to using the, "Seek" instead. I tried making the change. I get a Compile error that says, "Argument is not...
2
by: rivka.howley | last post by:
I wrote some code that creates a table with a date/time field at 15-minute intervals. Here's how I create and populate the table With tblDataTemp ..Fields.Append .CreateField("CT_ID", dbLong)...
3
by: developing | last post by:
Hello How do I specify multiple criteria for FindFirst or FindRecord (or anything else) that takes the criteria from a form. (text field and number field) edit: this will be in the after...
7
by: waltvw | last post by:
I'm using FindFirst method in Access VBA to find a particular record in a recordset. I have 2 search criteria each of which works just fine if used separately as an argument in FindFirst, but NOT in...
2
by: Denise | last post by:
Front end is Access 2002, back end is linked Oracle tables. My users need to describe things in feet and inches and want to use the standard ' and " abbrevations. On a testing form I go to a...
25
by: Rick Collard | last post by:
Using DAO 3.6 on an Access 2002 database, I'm getting unexpected results with the FindFirst method. Here's the simple code to test: Public Sub FindIt() Dim db As Database, rs As Recordset...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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...
0
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...
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...

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.