Need help with programming again

  • Thread starter Afrosheen via AccessMonster.com
  • Start date
A

Afrosheen via AccessMonster.com

I have two fields. [desc] for description of an item, and [assignedto1] which
is the person the item is assigned to. What I want to do is to separate the
two.

The code that's displayed works ok.
80 strWhere = "[desc] like""" & txtSearch & _
""" and [assignedto1]=""" & Str & """"
90 Filter = strWhere
100 FilterOn = True

The thing is that the second part of the code on line 80 I may or may not
need.

For example: The code field [desc] may equal to hold the txtSearch or "Book*"
and the [assignedto1] holds the name of the person that uses the item. Like I
said, it works ok.

What I'd like to do is if I enter the [desc] like book* and there is no
[assignedo1] information then skip the rest of the code. Is there a way of
doing this? I know using this code:

strWhere = "[desc] Like '" & Me!txtSearch & "'" will do the single search or
filter.

So I guess I want to do one or the other through code.

Thank you for your help again. It's really appreciated.
 
P

PieterLinden via AccessMonster.com

Afrosheen said:
I have two fields. [desc] for description of an item, and [assignedto1] which
is the person the item is assigned to. What I want to do is to separate the
two.

The code that's displayed works ok.
80 strWhere = "[desc] like""" & txtSearch & _
""" and [assignedto1]=""" & Str & """"
90 Filter = strWhere
100 FilterOn = True

The thing is that the second part of the code on line 80 I may or may not
need.

For example: The code field [desc] may equal to hold the txtSearch or "Book*"
and the [assignedto1] holds the name of the person that uses the item. Like I
said, it works ok.

What I'd like to do is if I enter the [desc] like book* and there is no
[assignedo1] information then skip the rest of the code. Is there a way of
doing this? I know using this code:

strWhere = "[desc] Like '" & Me!txtSearch & "'" will do the single search or
filter.

So I guess I want to do one or the other through code.

Thank you for your help again. It's really appreciated.
What I'd like to do is if I enter the [desc] like book* and there is no
[assignedo1] information then skip the rest of the code. Is there a way of
doing this?

You must be standing too close to see it... take a couple of steps back.
' build mandatory/always clause here...
strWhere = ....

'then add optional part based on what's chosen in the textbox...
If Not IsNull(Me![AssignedTo])
strWhere = strWhere & " AND [assignedTo1]=' " & me.cboAssignedTo &" ' "
End If
 
A

Afrosheen via AccessMonster.com

Thanks for getting back to me. I'll try it out on Monday. I'm on vacation for
the next couple of days.


I have two fields. [desc] for description of an item, and [assignedto1] which
is the person the item is assigned to. What I want to do is to separate the
[quoted text clipped - 23 lines]
Thank you for your help again. It's really appreciated.
What I'd like to do is if I enter the [desc] like book* and there is no
[assignedo1] information then skip the rest of the code. Is there a way of
doing this?

You must be standing too close to see it... take a couple of steps back.
' build mandatory/always clause here...
strWhere = ....

'then add optional part based on what's chosen in the textbox...
If Not IsNull(Me![AssignedTo])
strWhere = strWhere & " AND [assignedTo1]=' " & me.cboAssignedTo &" ' "
End If
 

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

Similar Threads

Detail in form goes blank 5
Search form help 3
Need Help with Macro Security 1
Frustrated with Form/Subform 2
Help with search code 4
Search criteria 9
Need some PWA help 0
Need help with this code 0

Top