OpenForm with criteria having multiple values?

Tekime

Registered User.
Local time
Today, 08:45
Joined
Jun 26, 2003
Messages
72
Hi all,

I'm trying to open a form with the OpenForm method using multiple values in a criteria field.

Basically, during data entry in my chargebacks DB, the DB checks the case number they enter for duplicates and if it finds duplicates I would like to open these duplicate cases in my case details form.

Everything works fine, and I retrieve the unique chargebackId of each duplicate record. But when I try to open the form specifying these chargebackId's as the criteria it only opens the first case in the list.

Here is the code I'm using now:


stDocName = "frm_ChargebackMain"

stLinkCriteria = ""

While (Not rs.EOF)

stLinkCriteria = stLinkCriteria & "[chargebackId] = " & rs("chargebackId")

rs.MoveNext

If (Not rs.EOF) Then
stLinkCriteria = stLinkCriteria & " OR "
End If

Wend

DoCmd.OpenForm stDocName, , stLinkCriteria, , acFormReadOnly


Where rs is the recordset containing the chargebackId's. Evaluating the criteria expression it looks like it should work. Normalyl it would look somethign like this:


[chargebackId] = 123 OR [chargebackId] = 422


But in this case only chargebackId 123 would be opened.

Please tell me what am I doing wrong! :( :o
 
Okay, I got it. The criteria format was fine, but the associated records I was testing did not have enough data populated to open in the case details view. Now I tested with a few other cases I knew were true duplicates and it's working fine. :)
 

Users who are viewing this thread

Back
Top Bottom