Unexpected Enter Parameter Box

G

Guest

I have created a Search form that uses combo boxes to select the various
search criteria. The form has a subform that creates a filter based on the
selections made via the combo boxes.

My problem is only one of the selection criteria works, the second criteria
brings up an Enter parameter box that requires me to re-enter the selection a
second time. If I re-enter the data and select OK, nothing happens. If I
simply press cancel it takes me to debugger. The highlighted portion it shows
me is pointed out below. The code is identical for both controls, except one
works and the other doesn't. Can anyone point me to where the problem could
be.

Here is a link to the code that I based my idea on. (Specifically the Search
Issues form)

http://office.microsoft.com/en-us/templates/TC012186931033.aspx?CategoryID=CT101426031033


Here is my code as I tried to adapt it.

Private Sub cmdSearch_Click()
Dim strWhere As String
‘DimstrError As String

strWhere = "1=1"

'If Employee Number
If Nz(Me.cboEmployeeNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Emp #] = " &
Me.cboEmployeeNumber & ""
End If

'If Project Number
If Nz(Me.cboProjectNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Proj #] = " &
Me.cboProjectNumber & ""
End If

If StrError <> "" Then
MsgBox StrError

Else
'DoCmd.OpenForm "fsubRecordSearch", acFormsDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.fsubRecordSearch.Form.Filter = strWhere
Me.fsubRecordSearch.Form.FilterOn = True **DEBUG HIGHLIGHTS THIS**
End If
End Sub

Thanks in advance to whatever brave soul attempts to help me with this!
 
G

Guest

Doesn't seem to make a difference. No visible change.

Cheese_whiz said:
I think you are missing a space in the "1=1"
I think it should be "1=1 "

CW

Justin83716 said:
I have created a Search form that uses combo boxes to select the various
search criteria. The form has a subform that creates a filter based on the
selections made via the combo boxes.

My problem is only one of the selection criteria works, the second criteria
brings up an Enter parameter box that requires me to re-enter the selection a
second time. If I re-enter the data and select OK, nothing happens. If I
simply press cancel it takes me to debugger. The highlighted portion it shows
me is pointed out below. The code is identical for both controls, except one
works and the other doesn't. Can anyone point me to where the problem could
be.

Here is a link to the code that I based my idea on. (Specifically the Search
Issues form)

http://office.microsoft.com/en-us/templates/TC012186931033.aspx?CategoryID=CT101426031033


Here is my code as I tried to adapt it.

Private Sub cmdSearch_Click()
Dim strWhere As String
‘DimstrError As String

strWhere = "1=1"

'If Employee Number
If Nz(Me.cboEmployeeNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Emp #] = " &
Me.cboEmployeeNumber & ""
End If

'If Project Number
If Nz(Me.cboProjectNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Proj #] = " &
Me.cboProjectNumber & ""
End If

If StrError <> "" Then
MsgBox StrError

Else
'DoCmd.OpenForm "fsubRecordSearch", acFormsDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.fsubRecordSearch.Form.Filter = strWhere
Me.fsubRecordSearch.Form.FilterOn = True **DEBUG HIGHLIGHTS THIS**
End If
End Sub

Thanks in advance to whatever brave soul attempts to help me with this!
 
G

Guest

I'm pretty sure that space needs to be there. It may not be the only reasons
but I've used that technique before and it was explained to me that the space
was critical (not that I ever doubted it).

CW

Justin83716 said:
Doesn't seem to make a difference. No visible change.

Cheese_whiz said:
I think you are missing a space in the "1=1"
I think it should be "1=1 "

CW

Justin83716 said:
I have created a Search form that uses combo boxes to select the various
search criteria. The form has a subform that creates a filter based on the
selections made via the combo boxes.

My problem is only one of the selection criteria works, the second criteria
brings up an Enter parameter box that requires me to re-enter the selection a
second time. If I re-enter the data and select OK, nothing happens. If I
simply press cancel it takes me to debugger. The highlighted portion it shows
me is pointed out below. The code is identical for both controls, except one
works and the other doesn't. Can anyone point me to where the problem could
be.

Here is a link to the code that I based my idea on. (Specifically the Search
Issues form)

http://office.microsoft.com/en-us/templates/TC012186931033.aspx?CategoryID=CT101426031033


Here is my code as I tried to adapt it.

Private Sub cmdSearch_Click()
Dim strWhere As String
‘DimstrError As String

strWhere = "1=1"

'If Employee Number
If Nz(Me.cboEmployeeNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Emp #] = " &
Me.cboEmployeeNumber & ""
End If

'If Project Number
If Nz(Me.cboProjectNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Proj #] = " &
Me.cboProjectNumber & ""
End If

If StrError <> "" Then
MsgBox StrError

Else
'DoCmd.OpenForm "fsubRecordSearch", acFormsDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.fsubRecordSearch.Form.Filter = strWhere
Me.fsubRecordSearch.Form.FilterOn = True **DEBUG HIGHLIGHTS THIS**
End If
End Sub

Thanks in advance to whatever brave soul attempts to help me with this!
 
G

Guest

Try this instead of the Nz things you have there (I don't get Nz without a
second argument):

If Not IsNull(yourcombobox) Then...

Also, lots of times people use multiple columns of information in a combo
box, such that a name might display in the box but the bound column is the
number. It's always a good idea to check for a mistake there.

Hope something helps here,
CW


Justin83716 said:
Doesn't seem to make a difference. No visible change.

Cheese_whiz said:
I think you are missing a space in the "1=1"
I think it should be "1=1 "

CW

Justin83716 said:
I have created a Search form that uses combo boxes to select the various
search criteria. The form has a subform that creates a filter based on the
selections made via the combo boxes.

My problem is only one of the selection criteria works, the second criteria
brings up an Enter parameter box that requires me to re-enter the selection a
second time. If I re-enter the data and select OK, nothing happens. If I
simply press cancel it takes me to debugger. The highlighted portion it shows
me is pointed out below. The code is identical for both controls, except one
works and the other doesn't. Can anyone point me to where the problem could
be.

Here is a link to the code that I based my idea on. (Specifically the Search
Issues form)

http://office.microsoft.com/en-us/templates/TC012186931033.aspx?CategoryID=CT101426031033


Here is my code as I tried to adapt it.

Private Sub cmdSearch_Click()
Dim strWhere As String
‘DimstrError As String

strWhere = "1=1"

'If Employee Number
If Nz(Me.cboEmployeeNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Emp #] = " &
Me.cboEmployeeNumber & ""
End If

'If Project Number
If Nz(Me.cboProjectNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Proj #] = " &
Me.cboProjectNumber & ""
End If

If StrError <> "" Then
MsgBox StrError

Else
'DoCmd.OpenForm "fsubRecordSearch", acFormsDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.fsubRecordSearch.Form.Filter = strWhere
Me.fsubRecordSearch.Form.FilterOn = True **DEBUG HIGHLIGHTS THIS**
End If
End Sub

Thanks in advance to whatever brave soul attempts to help me with this!
 
G

Guest

No change. I changed the coding from Nz to the Not IsNull coding but I get
the same results. One combo returns the data perfectly, the other pulls up an
Enter Parameter Box requesting I enter the criteria again.


Cheese_whiz said:
Try this instead of the Nz things you have there (I don't get Nz without a
second argument):

If Not IsNull(yourcombobox) Then...

Also, lots of times people use multiple columns of information in a combo
box, such that a name might display in the box but the bound column is the
number. It's always a good idea to check for a mistake there.

Hope something helps here,
CW


Justin83716 said:
Doesn't seem to make a difference. No visible change.

Cheese_whiz said:
I think you are missing a space in the "1=1"
I think it should be "1=1 "

CW

:

I have created a Search form that uses combo boxes to select the various
search criteria. The form has a subform that creates a filter based on the
selections made via the combo boxes.

My problem is only one of the selection criteria works, the second criteria
brings up an Enter parameter box that requires me to re-enter the selection a
second time. If I re-enter the data and select OK, nothing happens. If I
simply press cancel it takes me to debugger. The highlighted portion it shows
me is pointed out below. The code is identical for both controls, except one
works and the other doesn't. Can anyone point me to where the problem could
be.

Here is a link to the code that I based my idea on. (Specifically the Search
Issues form)

http://office.microsoft.com/en-us/templates/TC012186931033.aspx?CategoryID=CT101426031033


Here is my code as I tried to adapt it.

Private Sub cmdSearch_Click()
Dim strWhere As String
‘DimstrError As String

strWhere = "1=1"

'If Employee Number
If Nz(Me.cboEmployeeNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Emp #] = " &
Me.cboEmployeeNumber & ""
End If

'If Project Number
If Nz(Me.cboProjectNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Proj #] = " &
Me.cboProjectNumber & ""
End If

If StrError <> "" Then
MsgBox StrError

Else
'DoCmd.OpenForm "fsubRecordSearch", acFormsDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.fsubRecordSearch.Form.Filter = strWhere
Me.fsubRecordSearch.Form.FilterOn = True **DEBUG HIGHLIGHTS THIS**
End If
End Sub

Thanks in advance to whatever brave soul attempts to help me with this!
 
G

Guest

Also all of my combo boxes include only one column of data and should not
have any issues with the bound column property.

Cheese_whiz said:
Try this instead of the Nz things you have there (I don't get Nz without a
second argument):

If Not IsNull(yourcombobox) Then...

Also, lots of times people use multiple columns of information in a combo
box, such that a name might display in the box but the bound column is the
number. It's always a good idea to check for a mistake there.

Hope something helps here,
CW


Justin83716 said:
Doesn't seem to make a difference. No visible change.

Cheese_whiz said:
I think you are missing a space in the "1=1"
I think it should be "1=1 "

CW

:

I have created a Search form that uses combo boxes to select the various
search criteria. The form has a subform that creates a filter based on the
selections made via the combo boxes.

My problem is only one of the selection criteria works, the second criteria
brings up an Enter parameter box that requires me to re-enter the selection a
second time. If I re-enter the data and select OK, nothing happens. If I
simply press cancel it takes me to debugger. The highlighted portion it shows
me is pointed out below. The code is identical for both controls, except one
works and the other doesn't. Can anyone point me to where the problem could
be.

Here is a link to the code that I based my idea on. (Specifically the Search
Issues form)

http://office.microsoft.com/en-us/templates/TC012186931033.aspx?CategoryID=CT101426031033


Here is my code as I tried to adapt it.

Private Sub cmdSearch_Click()
Dim strWhere As String
‘DimstrError As String

strWhere = "1=1"

'If Employee Number
If Nz(Me.cboEmployeeNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Emp #] = " &
Me.cboEmployeeNumber & ""
End If

'If Project Number
If Nz(Me.cboProjectNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Proj #] = " &
Me.cboProjectNumber & ""
End If

If StrError <> "" Then
MsgBox StrError

Else
'DoCmd.OpenForm "fsubRecordSearch", acFormsDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.fsubRecordSearch.Form.Filter = strWhere
Me.fsubRecordSearch.Form.FilterOn = True **DEBUG HIGHLIGHTS THIS**
End If
End Sub

Thanks in advance to whatever brave soul attempts to help me with this!
 
G

Guest

Could you have possibly named your combo box the same thing as the field it's
bound to? Sometimes that causes troubles.

CW

Justin83716 said:
Also all of my combo boxes include only one column of data and should not
have any issues with the bound column property.

Cheese_whiz said:
Try this instead of the Nz things you have there (I don't get Nz without a
second argument):

If Not IsNull(yourcombobox) Then...

Also, lots of times people use multiple columns of information in a combo
box, such that a name might display in the box but the bound column is the
number. It's always a good idea to check for a mistake there.

Hope something helps here,
CW


Justin83716 said:
Doesn't seem to make a difference. No visible change.

:

I think you are missing a space in the "1=1"
I think it should be "1=1 "

CW

:

I have created a Search form that uses combo boxes to select the various
search criteria. The form has a subform that creates a filter based on the
selections made via the combo boxes.

My problem is only one of the selection criteria works, the second criteria
brings up an Enter parameter box that requires me to re-enter the selection a
second time. If I re-enter the data and select OK, nothing happens. If I
simply press cancel it takes me to debugger. The highlighted portion it shows
me is pointed out below. The code is identical for both controls, except one
works and the other doesn't. Can anyone point me to where the problem could
be.

Here is a link to the code that I based my idea on. (Specifically the Search
Issues form)

http://office.microsoft.com/en-us/templates/TC012186931033.aspx?CategoryID=CT101426031033


Here is my code as I tried to adapt it.

Private Sub cmdSearch_Click()
Dim strWhere As String
‘DimstrError As String

strWhere = "1=1"

'If Employee Number
If Nz(Me.cboEmployeeNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Emp #] = " &
Me.cboEmployeeNumber & ""
End If

'If Project Number
If Nz(Me.cboProjectNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Proj #] = " &
Me.cboProjectNumber & ""
End If

If StrError <> "" Then
MsgBox StrError

Else
'DoCmd.OpenForm "fsubRecordSearch", acFormsDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.fsubRecordSearch.Form.Filter = strWhere
Me.fsubRecordSearch.Form.FilterOn = True **DEBUG HIGHLIGHTS THIS**
End If
End Sub

Thanks in advance to whatever brave soul attempts to help me with this!
 
G

Guest

I've tried to use proper naming conventions for everything. tblWhatever,
cboWhatever, frmWhatever, etc... So shouldn't be any issues there.

Cheese_whiz said:
Could you have possibly named your combo box the same thing as the field it's
bound to? Sometimes that causes troubles.

CW

Justin83716 said:
Also all of my combo boxes include only one column of data and should not
have any issues with the bound column property.

Cheese_whiz said:
Try this instead of the Nz things you have there (I don't get Nz without a
second argument):

If Not IsNull(yourcombobox) Then...

Also, lots of times people use multiple columns of information in a combo
box, such that a name might display in the box but the bound column is the
number. It's always a good idea to check for a mistake there.

Hope something helps here,
CW


:

Doesn't seem to make a difference. No visible change.

:

I think you are missing a space in the "1=1"
I think it should be "1=1 "

CW

:

I have created a Search form that uses combo boxes to select the various
search criteria. The form has a subform that creates a filter based on the
selections made via the combo boxes.

My problem is only one of the selection criteria works, the second criteria
brings up an Enter parameter box that requires me to re-enter the selection a
second time. If I re-enter the data and select OK, nothing happens. If I
simply press cancel it takes me to debugger. The highlighted portion it shows
me is pointed out below. The code is identical for both controls, except one
works and the other doesn't. Can anyone point me to where the problem could
be.

Here is a link to the code that I based my idea on. (Specifically the Search
Issues form)

http://office.microsoft.com/en-us/templates/TC012186931033.aspx?CategoryID=CT101426031033


Here is my code as I tried to adapt it.

Private Sub cmdSearch_Click()
Dim strWhere As String
‘DimstrError As String

strWhere = "1=1"

'If Employee Number
If Nz(Me.cboEmployeeNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Emp #] = " &
Me.cboEmployeeNumber & ""
End If

'If Project Number
If Nz(Me.cboProjectNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Proj #] = " &
Me.cboProjectNumber & ""
End If

If StrError <> "" Then
MsgBox StrError

Else
'DoCmd.OpenForm "fsubRecordSearch", acFormsDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.fsubRecordSearch.Form.Filter = strWhere
Me.fsubRecordSearch.Form.FilterOn = True **DEBUG HIGHLIGHTS THIS**
End If
End Sub

Thanks in advance to whatever brave soul attempts to help me with this!
 
M

Marshall Barton

I don't see anywhere in this thread where you say what you
are prompted to enter. The prompt dialog should be telling
you exactly what it wants you to enter.
--
Marsh
MVP [MS Access]

I've tried to use proper naming conventions for everything. tblWhatever,
cboWhatever, frmWhatever, etc... So shouldn't be any issues there.

Cheese_whiz said:
Could you have possibly named your combo box the same thing as the field it's
bound to? Sometimes that causes troubles.

CW

Justin83716 said:
Also all of my combo boxes include only one column of data and should not
have any issues with the bound column property.

:

Try this instead of the Nz things you have there (I don't get Nz without a
second argument):

If Not IsNull(yourcombobox) Then...

Also, lots of times people use multiple columns of information in a combo
box, such that a name might display in the box but the bound column is the
number. It's always a good idea to check for a mistake there.

Hope something helps here,
CW


:

Doesn't seem to make a difference. No visible change.

:

I think you are missing a space in the "1=1"
I think it should be "1=1 "

CW

:

I have created a Search form that uses combo boxes to select the various
search criteria. The form has a subform that creates a filter based on the
selections made via the combo boxes.

My problem is only one of the selection criteria works, the second criteria
brings up an Enter parameter box that requires me to re-enter the selection a
second time. If I re-enter the data and select OK, nothing happens. If I
simply press cancel it takes me to debugger. The highlighted portion it shows
me is pointed out below. The code is identical for both controls, except one
works and the other doesn't. Can anyone point me to where the problem could
be.

Here is a link to the code that I based my idea on. (Specifically the Search
Issues form)

http://office.microsoft.com/en-us/templates/TC012186931033.aspx?CategoryID=CT101426031033


Here is my code as I tried to adapt it.

Private Sub cmdSearch_Click()
Dim strWhere As String
‘DimstrError As String

strWhere = "1=1"

'If Employee Number
If Nz(Me.cboEmployeeNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Emp #] = " &
Me.cboEmployeeNumber & ""
End If

'If Project Number
If Nz(Me.cboProjectNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Proj #] = " &
Me.cboProjectNumber & ""
End If

If StrError <> "" Then
MsgBox StrError

Else
'DoCmd.OpenForm "fsubRecordSearch", acFormsDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.fsubRecordSearch.Form.Filter = strWhere
Me.fsubRecordSearch.Form.FilterOn = True **DEBUG HIGHLIGHTS THIS**
End If
End Sub

Thanks in advance to whatever brave soul attempts to help me with this!
 
G

Guest

I actually have a number of combo boxes and aside from the one that works,
all other combos prompt me with one of two things.

1) tblEmployeeProjectDetails.[specific field name here]

Example: If I am using the Project combo and select project number 1234 and
select my search command button, box pops up with above text. Regardless of
what I enter, pressing OK does nothing and pressing CANCEL opens the debugger
which highlights the code below.

Me.fsubRecordSearch.Form.FilterOn = True

2) It asks for whatever criteria I have entered to be input again.

Example: If I am using the State combo and select CA, the box pops up and
displays CA and asks for the criteria to be entered again. If I put CA in
again and select OK, the filter works fine.


Marshall Barton said:
I don't see anywhere in this thread where you say what you
are prompted to enter. The prompt dialog should be telling
you exactly what it wants you to enter.
--
Marsh
MVP [MS Access]

I've tried to use proper naming conventions for everything. tblWhatever,
cboWhatever, frmWhatever, etc... So shouldn't be any issues there.

Cheese_whiz said:
Could you have possibly named your combo box the same thing as the field it's
bound to? Sometimes that causes troubles.

CW

:

Also all of my combo boxes include only one column of data and should not
have any issues with the bound column property.

:

Try this instead of the Nz things you have there (I don't get Nz without a
second argument):

If Not IsNull(yourcombobox) Then...

Also, lots of times people use multiple columns of information in a combo
box, such that a name might display in the box but the bound column is the
number. It's always a good idea to check for a mistake there.

Hope something helps here,
CW


:

Doesn't seem to make a difference. No visible change.

:

I think you are missing a space in the "1=1"
I think it should be "1=1 "

CW

:

I have created a Search form that uses combo boxes to select the various
search criteria. The form has a subform that creates a filter based on the
selections made via the combo boxes.

My problem is only one of the selection criteria works, the second criteria
brings up an Enter parameter box that requires me to re-enter the selection a
second time. If I re-enter the data and select OK, nothing happens. If I
simply press cancel it takes me to debugger. The highlighted portion it shows
me is pointed out below. The code is identical for both controls, except one
works and the other doesn't. Can anyone point me to where the problem could
be.

Here is a link to the code that I based my idea on. (Specifically the Search
Issues form)

http://office.microsoft.com/en-us/templates/TC012186931033.aspx?CategoryID=CT101426031033


Here is my code as I tried to adapt it.

Private Sub cmdSearch_Click()
Dim strWhere As String
‘DimstrError As String

strWhere = "1=1"

'If Employee Number
If Nz(Me.cboEmployeeNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Emp #] = " &
Me.cboEmployeeNumber & ""
End If

'If Project Number
If Nz(Me.cboProjectNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Proj #] = " &
Me.cboProjectNumber & ""
End If

If StrError <> "" Then
MsgBox StrError

Else
'DoCmd.OpenForm "fsubRecordSearch", acFormsDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.fsubRecordSearch.Form.Filter = strWhere
Me.fsubRecordSearch.Form.FilterOn = True **DEBUG HIGHLIGHTS THIS**
End If
End Sub

Thanks in advance to whatever brave soul attempts to help me with this!
 
G

Guest

To clarify my previous post, example 1) should have been
*tblEmployeeProjectDetails.specific field name here*
NOT *tblEmployeeProjectDetails.[specific field name here]* when it shows up
in the Enter Parameter Box it drops the brackets from the field name.

Also I should point out that most of the combo boxes respond like example 2).

Justin83716 said:
I actually have a number of combo boxes and aside from the one that works,
all other combos prompt me with one of two things.

1) tblEmployeeProjectDetails.[specific field name here]

Example: If I am using the Project combo and select project number 1234 and
select my search command button, box pops up with above text. Regardless of
what I enter, pressing OK does nothing and pressing CANCEL opens the debugger
which highlights the code below.

Me.fsubRecordSearch.Form.FilterOn = True

2) It asks for whatever criteria I have entered to be input again.

Example: If I am using the State combo and select CA, the box pops up and
displays CA and asks for the criteria to be entered again. If I put CA in
again and select OK, the filter works fine.


Marshall Barton said:
I don't see anywhere in this thread where you say what you
are prompted to enter. The prompt dialog should be telling
you exactly what it wants you to enter.
--
Marsh
MVP [MS Access]

I've tried to use proper naming conventions for everything. tblWhatever,
cboWhatever, frmWhatever, etc... So shouldn't be any issues there.

:

Could you have possibly named your combo box the same thing as the field it's
bound to? Sometimes that causes troubles.

CW

:

Also all of my combo boxes include only one column of data and should not
have any issues with the bound column property.

:

Try this instead of the Nz things you have there (I don't get Nz without a
second argument):

If Not IsNull(yourcombobox) Then...

Also, lots of times people use multiple columns of information in a combo
box, such that a name might display in the box but the bound column is the
number. It's always a good idea to check for a mistake there.

Hope something helps here,
CW


:

Doesn't seem to make a difference. No visible change.

:

I think you are missing a space in the "1=1"
I think it should be "1=1 "

CW

:

I have created a Search form that uses combo boxes to select the various
search criteria. The form has a subform that creates a filter based on the
selections made via the combo boxes.

My problem is only one of the selection criteria works, the second criteria
brings up an Enter parameter box that requires me to re-enter the selection a
second time. If I re-enter the data and select OK, nothing happens. If I
simply press cancel it takes me to debugger. The highlighted portion it shows
me is pointed out below. The code is identical for both controls, except one
works and the other doesn't. Can anyone point me to where the problem could
be.

Here is a link to the code that I based my idea on. (Specifically the Search
Issues form)

http://office.microsoft.com/en-us/templates/TC012186931033.aspx?CategoryID=CT101426031033


Here is my code as I tried to adapt it.

Private Sub cmdSearch_Click()
Dim strWhere As String
‘DimstrError As String

strWhere = "1=1"

'If Employee Number
If Nz(Me.cboEmployeeNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Emp #] = " &
Me.cboEmployeeNumber & ""
End If

'If Project Number
If Nz(Me.cboProjectNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Proj #] = " &
Me.cboProjectNumber & ""
End If

If StrError <> "" Then
MsgBox StrError

Else
'DoCmd.OpenForm "fsubRecordSearch", acFormsDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.fsubRecordSearch.Form.Filter = strWhere
Me.fsubRecordSearch.Form.FilterOn = True **DEBUG HIGHLIGHTS THIS**
End If
End Sub

Thanks in advance to whatever brave soul attempts to help me with this!
 
M

Marshall Barton

If you are prompted for
'tblEmployeeProjectDetails.Proj #'
it implies that there is no such thing in the form's record
source table/query. [Side note: there is no need to include
the table name in the criteria.]

If you are prompted for:
'CA'
then the state field is a Text field and the value must be
enclosed in quotes. Change your code for these criteria to
this kind of thing:

If Not IsNull(Me.cboState) Then
strWhere = strWhere & " AND State='" & Me.cboState & "' "
End If

If you need more help, please post a current copy of your
code.
--
Marsh
MVP [MS Access]

To clarify my previous post, example 1) should have been
*tblEmployeeProjectDetails.specific field name here*
NOT *tblEmployeeProjectDetails.[specific field name here]* when it shows up
in the Enter Parameter Box it drops the brackets from the field name.

Also I should point out that most of the combo boxes respond like example 2).

Justin83716 said:
I actually have a number of combo boxes and aside from the one that works,
all other combos prompt me with one of two things.

1) tblEmployeeProjectDetails.[specific field name here]

Example: If I am using the Project combo and select project number 1234 and
select my search command button, box pops up with above text. Regardless of
what I enter, pressing OK does nothing and pressing CANCEL opens the debugger
which highlights the code below.

Me.fsubRecordSearch.Form.FilterOn = True

2) It asks for whatever criteria I have entered to be input again.

Example: If I am using the State combo and select CA, the box pops up and
displays CA and asks for the criteria to be entered again. If I put CA in
again and select OK, the filter works fine.


Marshall Barton said:
I don't see anywhere in this thread where you say what you
are prompted to enter. The prompt dialog should be telling
you exactly what it wants you to enter.


Justin83716 wrote:

I've tried to use proper naming conventions for everything. tblWhatever,
cboWhatever, frmWhatever, etc... So shouldn't be any issues there.

:

Could you have possibly named your combo box the same thing as the field it's
bound to? Sometimes that causes troubles.

CW

:

Also all of my combo boxes include only one column of data and should not
have any issues with the bound column property.

:

Try this instead of the Nz things you have there (I don't get Nz without a
second argument):

If Not IsNull(yourcombobox) Then...

Also, lots of times people use multiple columns of information in a combo
box, such that a name might display in the box but the bound column is the
number. It's always a good idea to check for a mistake there.

Hope something helps here,
CW


:

Doesn't seem to make a difference. No visible change.

:

I think you are missing a space in the "1=1"
I think it should be "1=1 "

CW

:

I have created a Search form that uses combo boxes to select the various
search criteria. The form has a subform that creates a filter based on the
selections made via the combo boxes.

My problem is only one of the selection criteria works, the second criteria
brings up an Enter parameter box that requires me to re-enter the selection a
second time. If I re-enter the data and select OK, nothing happens. If I
simply press cancel it takes me to debugger. The highlighted portion it shows
me is pointed out below. The code is identical for both controls, except one
works and the other doesn't. Can anyone point me to where the problem could
be.

Here is a link to the code that I based my idea on. (Specifically the Search
Issues form)

http://office.microsoft.com/en-us/templates/TC012186931033.aspx?CategoryID=CT101426031033


Here is my code as I tried to adapt it.

Private Sub cmdSearch_Click()
Dim strWhere As String
‘DimstrError As String

strWhere = "1=1"

'If Employee Number
If Nz(Me.cboEmployeeNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Emp #] = " &
Me.cboEmployeeNumber & ""
End If

'If Project Number
If Nz(Me.cboProjectNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Proj #] = " &
Me.cboProjectNumber & ""
End If

If StrError <> "" Then
MsgBox StrError

Else
'DoCmd.OpenForm "fsubRecordSearch", acFormsDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.fsubRecordSearch.Form.Filter = strWhere
Me.fsubRecordSearch.Form.FilterOn = True **DEBUG HIGHLIGHTS THIS**
End If
End Sub

Thanks in advance to whatever brave soul attempts to help me with this!
 

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