"On click" problem

C

Caroline

I have 2 forms which I want to link using the "on click" event in the
properties.
One form is tabular with all case numbers, and the other is tabular a detail
of each case (columnar). I want to click a case in the tabular form and get
to the details of that case number.

In my macro builder, the action is "open form" and the "where condition"
says "="[case_number]=" & Nz([case_number],0)"

When clicking on the case number which should open the detail form for me, I
get the following error message: Data type mismatch in criteria expression.
The help displays: "The criteria expression in a Find method is attempting to
compare a field with a value whose data type does not match the field's data
type."

Since "Case number" in both forms is actually taken from the same table -is
the same field- how could they be of different type?

Thank you for your help.
Caroline
 
C

Clifford Bass

Hi Caroline,

That seems a rather odd construction. Try this instead, where
"frmBeingClicked" is the name of the form with the On Click event:

[case_number]=[Forms]![frmBeingClicked]![case_number]

Clifford Bass
 
C

Caroline

Hi Clifford, (I copied that 1st expression from a template)
I tried your expression but it opens the form to the 1st case number no
matter which case I click on. I'd like the form to open to the corresponding
case.
Thanks,
Caroline


Clifford Bass said:
Hi Caroline,

That seems a rather odd construction. Try this instead, where
"frmBeingClicked" is the name of the form with the On Click event:

[case_number]=[Forms]![frmBeingClicked]![case_number]

Clifford Bass

Caroline said:
I have 2 forms which I want to link using the "on click" event in the
properties.
One form is tabular with all case numbers, and the other is tabular a detail
of each case (columnar). I want to click a case in the tabular form and get
to the details of that case number.

In my macro builder, the action is "open form" and the "where condition"
says "="[case_number]=" & Nz([case_number],0)"

When clicking on the case number which should open the detail form for me, I
get the following error message: Data type mismatch in criteria expression.
The help displays: "The criteria expression in a Find method is attempting to
compare a field with a value whose data type does not match the field's data
type."

Since "Case number" in both forms is actually taken from the same table -is
the same field- how could they be of different type?

Thank you for your help.
Caroline
 
C

Clifford Bass

Hi Caroline,

That is curious, because what I posted works fine for me. It would
seem to me that it is viewing the first record in the form as being the
current record regardless of which case you are click into. To check whether
or not this is true, add a new line to the top of your macro that does a
MsgBox. For its message put:

=[case_number]

Close and save. Then try clicking in different case numbers and see
what it says.

Clifford Bass
 
C

Caroline

The "Msgbox" works, it gives me the right case number, but the form opens
blank or with only one record (I didn't notice that before). I tried it in a
different database with student IDs, and it gave me the same weird results
--> blank form opening (the right form but without records in it).

Clifford Bass said:
Hi Caroline,

That is curious, because what I posted works fine for me. It would
seem to me that it is viewing the first record in the form as being the
current record regardless of which case you are click into. To check whether
or not this is true, add a new line to the top of your macro that does a
MsgBox. For its message put:

=[case_number]

Close and save. Then try clicking in different case numbers and see
what it says.

Clifford Bass

Caroline said:
Hi Clifford, (I copied that 1st expression from a template)
I tried your expression but it opens the form to the 1st case number no
matter which case I click on. I'd like the form to open to the corresponding
case.
Thanks,
Caroline
 
C

Caroline

It actually gets weirder, I was wrong before.
(Adding the "msgbox" gives me the case number I'm clicking, so this part
seems to work fine.).

When I click on the case number it opens the form but it has no records at
all in it (it should, there are 41 in there when I open it separately).

Clifford Bass said:
Hi Caroline,

That is curious, because what I posted works fine for me. It would
seem to me that it is viewing the first record in the form as being the
current record regardless of which case you are click into. To check whether
or not this is true, add a new line to the top of your macro that does a
MsgBox. For its message put:

=[case_number]

Close and save. Then try clicking in different case numbers and see
what it says.

Clifford Bass

Caroline said:
Hi Clifford, (I copied that 1st expression from a template)
I tried your expression but it opens the form to the 1st case number no
matter which case I click on. I'd like the form to open to the corresponding
case.
Thanks,
Caroline
 

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