How can i simulate the code in Macro?

O

ooxx

Hi all,

I need to write in procedure code when the macro is truncated the criteria.

I have two fields, and I would do in the macro on the subject of to open
report in print preview format and its where criteria as follows:
[hb] Like "*" & [Forms]![searchHearB]![Ssearch] & "*" Or [hb] Like
[Forms]![searchHearB]![Ssearch] & "*" Or "*" & [de] Like
[Forms]![searchHearB]![Ssearch] & "*" Or [de] Like "*" &
[Forms]![searchHearB]![Ssearch] Or [de] Like [Forms]![searchHearB]![Ssearch]
& "*"

I have problem to concatenate them in the code procedure.

I try from the simple but not success, the problem exists even it succeeds
in doing code format that Access can't find the field, though the fields
exists in the Report1.

Thans,
 
O

Ofer Cohen

Try using code instead of a macro.
Using code you can use the Debug and step through the lines, and view each
value.

Something like

Dim MyCriteria As String
MyCriteria = "[hb] Like *" & [Forms]![searchHearB]![Ssearch] & "* Or [de]
Like *" & [Forms]![searchHearB]![Ssearch] & "*"

Docmd.OpenReport "ReportName" , , , MyCriteria
 
O

ooxx

Hi,

I have test the code, but it gets bugs, and I can't fix. The problem is at
the "*" when concatenated on the last of the the sentence that it should be "
to close the sentence, but I don't know how to.

Thanks,


Ofer Cohen said:
Try using code instead of a macro.
Using code you can use the Debug and step through the lines, and view each
value.

Something like

Dim MyCriteria As String
MyCriteria = "[hb] Like *" & [Forms]![searchHearB]![Ssearch] & "* Or [de]
Like *" & [Forms]![searchHearB]![Ssearch] & "*"

Docmd.OpenReport "ReportName" , , , MyCriteria

--
Good Luck
BS"D


ooxx said:
Hi all,

I need to write in procedure code when the macro is truncated the criteria.

I have two fields, and I would do in the macro on the subject of to open
report in print preview format and its where criteria as follows:
[hb] Like "*" & [Forms]![searchHearB]![Ssearch] & "*" Or [hb] Like
[Forms]![searchHearB]![Ssearch] & "*" Or [de] Like
[Forms]![searchHearB]![Ssearch] & "*" Or [de] Like "*" &
[Forms]![searchHearB]![Ssearch] Or [de] Like [Forms]![searchHearB]![Ssearch]
& "*"

I have problem to concatenate them in the code procedure.

I try from the simple but not success, the problem exists even it succeeds
in doing code format that Access can't find the field, though the fields
exists in the Report1.

Thans,
 
O

Ofer Cohen

Try adding a single quote for the string

Dim MyCriteria As String
MyCriteria = "[hb] Like '*" & [Forms]![searchHearB]![Ssearch] & "*' Or [de]
Like '*" & [Forms]![searchHearB]![Ssearch] & "*'"

Docmd.OpenReport "ReportName" , , , MyCriteria


--
Good Luck
BS"D


ooxx said:
Hi,

I have test the code, but it gets bugs, and I can't fix. The problem is at
the "*" when concatenated on the last of the the sentence that it should be "
to close the sentence, but I don't know how to.

Thanks,


Ofer Cohen said:
Try using code instead of a macro.
Using code you can use the Debug and step through the lines, and view each
value.

Something like

Dim MyCriteria As String
MyCriteria = "[hb] Like *" & [Forms]![searchHearB]![Ssearch] & "* Or [de]
Like *" & [Forms]![searchHearB]![Ssearch] & "*"

Docmd.OpenReport "ReportName" , , , MyCriteria

--
Good Luck
BS"D


ooxx said:
Hi all,

I need to write in procedure code when the macro is truncated the criteria.

I have two fields, and I would do in the macro on the subject of to open
report in print preview format and its where criteria as follows:
[hb] Like "*" & [Forms]![searchHearB]![Ssearch] & "*" Or [hb] Like
[Forms]![searchHearB]![Ssearch] & "*" Or [de] Like
[Forms]![searchHearB]![Ssearch] & "*" Or [de] Like "*" &
[Forms]![searchHearB]![Ssearch] Or [de] Like [Forms]![searchHearB]![Ssearch]
& "*"

I have problem to concatenate them in the code procedure.

I try from the simple but not success, the problem exists even it succeeds
in doing code format that Access can't find the field, though the fields
exists in the Report1.

Thans,
 
O

ooxx

no,not works
glitch

Ofer Cohen said:
Try adding a single quote for the string

Dim MyCriteria As String
MyCriteria = "[hb] Like '*" & [Forms]![searchHearB]![Ssearch] & "*' Or [de]
Like '*" & [Forms]![searchHearB]![Ssearch] & "*'"

Docmd.OpenReport "ReportName" , , , MyCriteria


--
Good Luck
BS"D


ooxx said:
Hi,

I have test the code, but it gets bugs, and I can't fix. The problem is at
the "*" when concatenated on the last of the the sentence that it should be "
to close the sentence, but I don't know how to.

Thanks,


Ofer Cohen said:
Try using code instead of a macro.
Using code you can use the Debug and step through the lines, and view each
value.

Something like

Dim MyCriteria As String
MyCriteria = "[hb] Like *" & [Forms]![searchHearB]![Ssearch] & "* Or [de]
Like *" & [Forms]![searchHearB]![Ssearch] & "*"

Docmd.OpenReport "ReportName" , , , MyCriteria

--
Good Luck
BS"D


:

Hi all,

I need to write in procedure code when the macro is truncated the criteria.

I have two fields, and I would do in the macro on the subject of to open
report in print preview format and its where criteria as follows:
[hb] Like "*" & [Forms]![searchHearB]![Ssearch] & "*" Or [hb] Like
[Forms]![searchHearB]![Ssearch] & "*" Or [de] Like
[Forms]![searchHearB]![Ssearch] & "*" Or [de] Like "*" &
[Forms]![searchHearB]![Ssearch] Or [de] Like [Forms]![searchHearB]![Ssearch]
& "*"

I have problem to concatenate them in the code procedure.

I try from the simple but not success, the problem exists even it succeeds
in doing code format that Access can't find the field, though the fields
exists in the Report1.

Thans,
 
O

Ofer Cohen

What do you get? Is it an error or the report doesn't show the right records?

can you post the code you have?

--
Good Luck
BS"D


ooxx said:
no,not works
glitch

Ofer Cohen said:
Try adding a single quote for the string

Dim MyCriteria As String
MyCriteria = "[hb] Like '*" & [Forms]![searchHearB]![Ssearch] & "*' Or [de]
Like '*" & [Forms]![searchHearB]![Ssearch] & "*'"

Docmd.OpenReport "ReportName" , , , MyCriteria


--
Good Luck
BS"D


ooxx said:
Hi,

I have test the code, but it gets bugs, and I can't fix. The problem is at
the "*" when concatenated on the last of the the sentence that it should be "
to close the sentence, but I don't know how to.

Thanks,


:

Try using code instead of a macro.
Using code you can use the Debug and step through the lines, and view each
value.

Something like

Dim MyCriteria As String
MyCriteria = "[hb] Like *" & [Forms]![searchHearB]![Ssearch] & "* Or [de]
Like *" & [Forms]![searchHearB]![Ssearch] & "*"

Docmd.OpenReport "ReportName" , , , MyCriteria

--
Good Luck
BS"D


:

Hi all,

I need to write in procedure code when the macro is truncated the criteria.

I have two fields, and I would do in the macro on the subject of to open
report in print preview format and its where criteria as follows:
[hb] Like "*" & [Forms]![searchHearB]![Ssearch] & "*" Or [hb] Like
[Forms]![searchHearB]![Ssearch] & "*" Or [de] Like
[Forms]![searchHearB]![Ssearch] & "*" Or [de] Like "*" &
[Forms]![searchHearB]![Ssearch] Or [de] Like [Forms]![searchHearB]![Ssearch]
& "*"

I have problem to concatenate them in the code procedure.

I try from the simple but not success, the problem exists even it succeeds
in doing code format that Access can't find the field, though the fields
exists in the Report1.

Thans,
 
O

ooxx

Yeah it works now.

Thanks the single quot works. It's my stupidity. :p

Ofer Cohen said:
What do you get? Is it an error or the report doesn't show the right records?

can you post the code you have?

--
Good Luck
BS"D


ooxx said:
no,not works
glitch

Ofer Cohen said:
Try adding a single quote for the string

Dim MyCriteria As String
MyCriteria = "[hb] Like '*" & [Forms]![searchHearB]![Ssearch] & "*' Or [de]
Like '*" & [Forms]![searchHearB]![Ssearch] & "*'"

Docmd.OpenReport "ReportName" , , , MyCriteria


--
Good Luck
BS"D


:

Hi,

I have test the code, but it gets bugs, and I can't fix. The problem is at
the "*" when concatenated on the last of the the sentence that it should be "
to close the sentence, but I don't know how to.

Thanks,


:

Try using code instead of a macro.
Using code you can use the Debug and step through the lines, and view each
value.

Something like

Dim MyCriteria As String
MyCriteria = "[hb] Like *" & [Forms]![searchHearB]![Ssearch] & "* Or [de]
Like *" & [Forms]![searchHearB]![Ssearch] & "*"

Docmd.OpenReport "ReportName" , , , MyCriteria

--
Good Luck
BS"D


:

Hi all,

I need to write in procedure code when the macro is truncated the criteria.

I have two fields, and I would do in the macro on the subject of to open
report in print preview format and its where criteria as follows:
[hb] Like "*" & [Forms]![searchHearB]![Ssearch] & "*" Or [hb] Like
[Forms]![searchHearB]![Ssearch] & "*" Or [de] Like
[Forms]![searchHearB]![Ssearch] & "*" Or [de] Like "*" &
[Forms]![searchHearB]![Ssearch] Or [de] Like [Forms]![searchHearB]![Ssearch]
& "*"

I have problem to concatenate them in the code procedure.

I try from the simple but not success, the problem exists even it succeeds
in doing code format that Access can't find the field, though the fields
exists in the Report1.

Thans,
 
Top