Moten then one criteria to open a form with specific data

M

Marco

Hello.

I usually use this kind of code to open a open a specify the that that I
want to see.

» stLinkCriteria = "[Bud_Periodo_Dept_Rubrica]=" & "'" &
Me![Bud_Periodo_Dept_Rubrica] & "'"

But I need to specify moe then one criteria. can I do it from the form code
or do I have to go to the query?

I need soemthing looked like this:

» stLinkCriteria = "[Bud_Periodo_Dept_Rubrica]=" & "'" &
Me![Bud_Periodo_Dept_Rubrica] & "'" And me![NumeroPeriodo]

Is it possible?

PS: Please say yes.
 
M

Marshall Barton

Marco said:
I usually use this kind of code to open a open a specify the that that I
want to see.

» stLinkCriteria = "[Bud_Periodo_Dept_Rubrica]=" & "'" &
Me![Bud_Periodo_Dept_Rubrica] & "'"

But I need to specify moe then one criteria. can I do it from the form code
or do I have to go to the query?

I need soemthing looked like this:

» stLinkCriteria = "[Bud_Periodo_Dept_Rubrica]=" & "'" &
Me![Bud_Periodo_Dept_Rubrica] & "'" And me![NumeroPeriodo]


Please proof read and correct your typos before posting. It
is very difficult to read as it is.

I think that kind of thing would be more like:

stLinkCriteria = "Bud_Periodo_Dept_Rubrica='" & _
Me.Bud_Periodo_Dept_Rubrica & _
"' And NumeroPeriodo = " & Me.NumeroPeriodo
 
M

Marco

Hi,

I'm sorry from the bad english.

Yes, you understand my problem. I use to work with this kind of
stLinkCriteria to open forms with specific data on the second form.

Now I have a problem and I need to specify more then one criteria/filter to
open the second form with the specific data.

I did what you told me and it returns an error with the following message:
"Type Mismatch".

What can I do? Try to change the query behind the form?

Thanks,
Marco

Marshall Barton said:
Marco said:
I usually use this kind of code to open a open a specify the that that I
want to see.

» stLinkCriteria = "[Bud_Periodo_Dept_Rubrica]=" & "'" &
Me![Bud_Periodo_Dept_Rubrica] & "'"

But I need to specify moe then one criteria. can I do it from the form code
or do I have to go to the query?

I need soemthing looked like this:

» stLinkCriteria = "[Bud_Periodo_Dept_Rubrica]=" & "'" &
Me![Bud_Periodo_Dept_Rubrica] & "'" And me![NumeroPeriodo]


Please proof read and correct your typos before posting. It
is very difficult to read as it is.

I think that kind of thing would be more like:

stLinkCriteria = "Bud_Periodo_Dept_Rubrica='" & _
Me.Bud_Periodo_Dept_Rubrica & _
"' And NumeroPeriodo = " & Me.NumeroPeriodo
 
M

Marshall Barton

If a field (in its table) is type Text, you have to use
quotes around the value and if a field is a number type, you
can not use quotes areound the value.

If your NumeroPeriodo field is a Text field:

stLinkCriteria = "Bud_Periodo_Dept_Rubrica='" & _
Me.Bud_Periodo_Dept_Rubrica & _
"' And NumeroPeriodo = '" & Me.NumeroPeriodo & "' "

or, if the Bud_Periodo_Dept_Rubrica field is a number type
field:

stLinkCriteria = "Bud_Periodo_Dept_Rubrica=" & _
Me.Bud_Periodo_Dept_Rubrica & _
" And NumeroPeriodo = " & Me.NumeroPeriodo
--
Marsh
MVP [MS Access]

Yes, you understand my problem. I use to work with this kind of
stLinkCriteria to open forms with specific data on the second form.

Now I have a problem and I need to specify more then one criteria/filter to
open the second form with the specific data.

I did what you told me and it returns an error with the following message:
"Type Mismatch".

What can I do? Try to change the query behind the form?


Marshall Barton said:
I think that kind of thing would be more like:

stLinkCriteria = "Bud_Periodo_Dept_Rubrica='" & _
Me.Bud_Periodo_Dept_Rubrica & _
"' And NumeroPeriodo = " & Me.NumeroPeriodo
Marco said:
I usually use this kind of code to open a open a specify the that that I
want to see.

» stLinkCriteria = "[Bud_Periodo_Dept_Rubrica]=" & "'" &
Me![Bud_Periodo_Dept_Rubrica] & "'"

But I need to specify moe then one criteria. can I do it from the form code
or do I have to go to the query?

I need soemthing looked like this:

» stLinkCriteria = "[Bud_Periodo_Dept_Rubrica]=" & "'" &
Me![Bud_Periodo_Dept_Rubrica] & "'" And me![NumeroPeriodo]
 

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