469,648 Members | 1,431 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,648 developers. It's quick & easy.

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 4098
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Paul | last post: by
25 posts views Thread by Rick Collard | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.