473,388 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Access 2000- Multiple Conditions on multiple fields

17
I am using the current code to make a button visible.

Private Sub Form_Current()
If Me.related = "X" Then
Me.addinfo.Visible = True
Else
Me.addinfo.Visible = False
End If
End Sub

Works fine

I need to add a second condition to make a separate field trigger the same button to appear.

me.notes.isblank = false

In other words if there is anything in the notes field I also want the button to appear.

Another scenario I might want to code is if a certain piece of text appears in the notes field, I want the button to appear.

me.notes - "specific name" then make the button visible.

I'm not sure how to fit either code piece into what is currently working.

I tried....

Private Sub Form_Current()
If Me.related = "X" or me.notes.isblank = False Then
Me.addinfo.Visible = True
Else
Me.addinfo.Visible = False
End If
End Sub

It crashed

So did

Private Sub Form_Current()
If Me.related = "X" or Me.notes.isnull = False Then
Me.addinfo.Visible = True
Else
Me.addinfo.Visible = False
End If
End Sub

I know I am close but missing something simple.
Apr 5 '07 #1
9 2794
Rabbit
12,516 Expert Mod 8TB
It should be IsNull(Me.Notes) and equivalently IsBlank(Me.Notes).
Apr 5 '07 #2
Geneman
17
It should be IsNull(Me.Notes) and equivalently IsBlank(Me.Notes).
Ok, that works on ANY content in the field notes......
so for specific content would I use Me.Notes = "Specific Content"

What happens if that content is not the only thing in the field.
notes is a memo field and may contain a variety of entries.
I only want the button to show if a specific entry is part of those
entries.

Example:
Notes may include
Sources: Non-specific content, specific content, non specific content
or
Sources: Specific Content
or
Sources: Non Specific Content.

I only want the button to show on examples one and two but not on three.

And yes, I have thought about creating a separate entry field that triggers the
Additional Information button no matter what originating field triggers it.

Originally, the related field was the only field until I aquired other outside sources of additional information. Thus it expanded what could trigger the button.
Apr 5 '07 #3
Rabbit
12,516 Expert Mod 8TB
Ok, that works on ANY content in the field notes......
so for specific content would I use Me.Notes = "Specific Content"

What happens if that content is not the only thing in the field.
notes is a memo field and may contain a variety of entries.
I only want the button to show if a specific entry is part of those
entries.

Example:
Notes may include
Sources: Non-specific content, specific content, non specific content
or
Sources: Specific Content
or
Sources: Non Specific Content.

I only want the button to show on examples one and two but not on three.

And yes, I have thought about creating a separate entry field that triggers the
Additional Information button no matter what originating field triggers it.

Originally, the related field was the only field until I aquired other outside sources of additional information. Thus it expanded what could trigger the button.
Are the values actually "Specific Content" and "Non Specific Content"? Or is that just a variable for something else.
Apr 5 '07 #4
Geneman
17
Are the values actually "Specific Content" and "Non Specific Content"? Or is that just a variable for something else.
I was using them as generic examples.

The content of the notes memo field could look like any of these.

Source: Joe Smith
Sources: Obituary, Funeral Home, Census
Source: Funeral Home, Ralph Jones, Census, Bible
Source: Obituary

If the field contains,either Obituary or Funeral Home as a listed source, I would want my Additional Information button to appear.
If either or both of those two are not listed as a source, the Additional information button would not be triggered by that field, but it could still be triggered by the related field.

So what I need is the code to correct this second line to make it work.


Private Sub Form_Current()
If Me.related = "X" Or Me.notes contains "Obituary" or "Funeral Home" Then
Me.addinfo.Visible = True
Else
Me.addinfo.Visible = False
End If
End Sub
Apr 6 '07 #5
Rabbit
12,516 Expert Mod 8TB
To search for a substring within a string, use InStr(String, Substring). It returns the position that the substring starts.

string is zero-length = 0
string is Null = Null
substring is zero-length = 1
substring is Null = Null
substring is not found = 0
substring is found within string = Position at which match is found
Apr 6 '07 #6
Geneman
17
To search for a substring within a string, use InStr(String, Substring). It returns the position that the substring starts.
Here is what is working now, I'don't know if it is considered good or pure code or not.

Private Sub Form_Current()
If Me.related = "X" Or InStr(notes, "Funeral Home") Or InStr(notes, "Obituary") Then
Me.addinfo.Visible = True
Else
Me.addinfo.Visible = False
End If
End Sub

Is there any way to do multiple String pieces in one Instr command?
Something like this which did not work....
Instr(notes, "Obitary", "Funeral Home", "Bible")

I could have up to six or seven trigger words or more.

Eventually I want it coded so each trigger word shows a specific button or maybe a form with a price for that specific trigger item. That out to be fun, coding 6 buttons to view in the same place. I'm still thinking this one through.....
Apr 6 '07 #7
Rabbit
12,516 Expert Mod 8TB
No, you can't use InStr that way.

However, you could have a table with one field whose records consists solely of the strings and then use the DCount function to see if it exists in the table. That way, if you want to get rid of something or add something you just have to edit the table instead of the code.
Apr 6 '07 #8
Geneman
17
Interesting, then I could have 100 trigger words and a heck of a lot less coding.
Thanks!

Now on to reading how to implement DCount.
Apr 6 '07 #9
Rabbit
12,516 Expert Mod 8TB
Interesting, then I could have 100 trigger words and a heck of a lot less coding.
Thanks!

Now on to reading how to implement DCount.
Not a problem, let us know if you have any difficulty.
Apr 6 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: euang | last post by:
Hi, I have been using access 2000 for two years on WINDOWS NT to display dynamic aweb page using ASP My ISP has now changed to Windows 2003, and I am having major problems displaying...
1
by: M Wells | last post by:
Hi All, Just wondering if anyone can tell me if you can test for multiple conditions as part of an "IF" statement in T-SQL in SQL Server 2000? ie something like: IF @merr = 1 or @merr=2...
1
by: mark | last post by:
In Access 2000 and 2002, I have created an import specification to import the fixed-width recordset below into an existing table. I am having strange problems with the import of the date and time...
2
by: Rick Brandt | last post by:
I posted this issue a while back (over a year ago?) but thought I would take another crack at it. I have one user out of about 250 where my app's custom menu bar does not work on any of the...
3
by: CSDunn | last post by:
Hello, I have a situation with MS Access 2000 in which I need to display report data in spreadsheet orientation (much like a datasheet view for a form). If you think of the report in terms of what...
5
by: Tara via AccessMonster.com | last post by:
Hi there - I'll do my best to explain my dilema. I'm using Access 2000. In this database, there is one table with about 150 columns of information, and 206 rows. There are numerous queries and...
2
by: collegekid | last post by:
Hi everyone, basically my problem is this: I am using an Access 2000 format. And--I have four subforms in my main form. (Purpose of this is to track projects.) So in my main form I enter the...
2
by: Sam Shaw | last post by:
I have been looking after an MS Access database, using table links to access data in a back-end MDB database. We have recently micrated to a SQL Server 2000 back-end atabase, once again accessing...
13
by: Owen Jenkins | last post by:
Following on from an earlier post... I can reliably corrupt a record by doing the following ... Open two separate but identical front ends on one PC each linking to the same back end. Edit a...
1
by: stierle | last post by:
Background: I'm using Access 2000 and have a form with several listboxes on it (listB, listP, listT) I'm need to find a way to link items from different boxes. I have a matchID in the table and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.