OnFormat problem (Acc2003)

J

Jerome

Hi,

I've created a report with the following code in the OnFormat Event of
the Detail section:

*******************************
Select Case Me.IDRubrique
Case 1 Or 2
t1 = "blah blah"
t2 = "blah blah"
Case 3 Or 4
t1 = "blah blah"
t2 = "blah blah"
Case 5 Or 6
t1 = "blah blah"
t2 = "blah blah"
Case 7 Or 8
t1 = "blah blah"
t2 = "blah blah"
End Select

Me.txtRDV = t1
Me.txtEnfants = t2
Me.txtEmpechement = t3
Me.txtSignature = t4
********************************

(the Me.txt... fields being unbound)

The problem is that he doesn't assign the right text to the unbound
fields!? It seems random. For example if the record's IDRubrique is 1,
he writes the text from 'Case 3 or 4' instead of 'Case 1 or 2'. Or if
the record's IDRubrique is 5, he doesn't write any text at all.

What could the problem be!? Or how do I need to tackle this?

Thanks a lot,

Jerome
 
R

Rick Brandt

Jerome said:
I've created a report with the following code in the OnFormat Event of
the Detail section:

*******************************
Select Case Me.IDRubrique
Case 1 Or 2
t1 = "blah blah"
t2 = "blah blah"
Case 3 Or 4 [snip]
The problem is that he doesn't assign the right text to the unbound
fields!? It seems random. For example if the record's IDRubrique is 1,
he writes the text from 'Case 3 or 4' instead of 'Case 1 or 2'. Or if
the record's IDRubrique is 5, he doesn't write any text at all.

What could the problem be!? Or how do I need to tackle this?

I don't think you can use "Or" in a Case statement like that. It does
accept comma separated vlaues and ranges though so try...

Select Case Me.IDRubrique
Case 1, 2
t1 = "blah blah"
t2 = "blah blah"
Case 3, 4
t1 = "blah blah"
t2 = "blah blah"
Case 5, 6
t1 = "blah blah"
t2 = "blah blah"
Case 7, 8
t1 = "blah blah"
t2 = "blah blah"
End Select
 
J

Jerome

SILLY ME! That was the whole problem indeed :)

Thanks, mate.

Rick said:
Jerome said:
I've created a report with the following code in the OnFormat Event of
the Detail section:

*******************************
Select Case Me.IDRubrique
Case 1 Or 2
t1 = "blah blah"
t2 = "blah blah"
Case 3 Or 4
[snip]

The problem is that he doesn't assign the right text to the unbound
fields!? It seems random. For example if the record's IDRubrique is 1,
he writes the text from 'Case 3 or 4' instead of 'Case 1 or 2'. Or if
the record's IDRubrique is 5, he doesn't write any text at all.

What could the problem be!? Or how do I need to tackle this?


I don't think you can use "Or" in a Case statement like that. It does
accept comma separated vlaues and ranges though so try...

Select Case Me.IDRubrique
Case 1, 2
t1 = "blah blah"
t2 = "blah blah"
Case 3, 4
t1 = "blah blah"
t2 = "blah blah"
Case 5, 6
t1 = "blah blah"
t2 = "blah blah"
Case 7, 8
t1 = "blah blah"
t2 = "blah blah"
End Select
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top