By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,635 Members | 913 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,635 IT Pros & Developers. It's quick & easy.


P: 27

I have this condition:

Expand|Select|Wrap|Line Numbers
  1. If Left(Me.GCN, 1) = 9 And Len(Me.txt_ClientCodeString & vbNullString) = 0 Then
  2.         MsgBox "You have selected a National GCN." & vbCrLf & vbCrLf & "Therefore, you must enter valid client codes against this record before saving.", _
  3.         vbCritical, "Missing Information"
  4.     Else
  5.         Left(Me.GCN, 1) = 9 And Len(Me.txt_ClientCodeString & vbNullString) = ""
  7.         Exit Sub
  8.     End If
I need a condition that accept to inactive a National Schedule even when it does not have client codes, How can I start that condition with a look up or is there anything else to do that? Please help.
Feb 28 '18 #1
Share this Question
Share on Google+
5 Replies

Expert Mod 2.5K+
P: 3,204

First, does your code, as is, work properly? Is it giving you the current results that you want? I would venture to guess that it is not, simply from the statements under the Else.

Second, it is not exactly clear from your question, what it is that you are asking assistance on.

We would love to help, but we need a little more information to move forward.

Thanks for any clarification you can provide!
Feb 28 '18 #2

P: 27
1- the code works fine
2- I just need to add a second condition where accept to inactive a schedule without the need of having client codes, the code at this moment what it does is inactive a National schedule only if carry client codes but how about if it does not how can I do that statement, do I need to to a Dlookup first to find if that specific schedule that I want to deactivate carries any client code in other words having or not client codes I want to inactivate a schedule.

Thank you for your help, hopefully I explain myself more clearly.

Feb 28 '18 #3

Expert Mod 2.5K+
P: 3,204

At this point, I think it may be more of a language barrier than anything else. We will do our best to work through this as ably as we can! :-)

If I can try to interpret what I understand so far:

If a client selects a schedule with a client code, that schedule should be "deactivated". If they select a schedule that does not have a client code, it should also be "deactivated." Is this an accurate understanding? (aside from knowing what is meant by "deactivating")

On the most basic plane, if this is the case, then there is no need to check to see if there is a client code; just deactivate the schedule. Unless of course there are additional different actions required for each of the circumstances.

Please let me know if I am missing something significant.

Feb 28 '18 #4

P: 27
That's almost correct but it won't let me if: "MsgBox "You have selected a National GCN." & vbCrLf & vbCrLf & "Therefore, you must enter valid client codes against this record before saving.", _
vbCritical, "Missing Information"

So in other words if I enter a GCN (Global Client Number) and the DB recognize it as "National" and If It has client codes will go ahead and deactivate, but If it is a National account without client codes will not deactivate it, but how about the cases on where a GCN does not have Client codes (That's the logic I a missing in my code) How can I add the logic within the code already built?
Feb 28 '18 #5

Expert Mod 2.5K+
P: 3,204
At this point, it might be helpful if we broke it down into steps.

I am assuming this is on a Form?

Me.GCN - is this a Text Box/Combo Box control, or is it a value from the underlying Record Source (Table/Query)? It appears you are evaluating the first character of the string, checking to see if it equals 9. This may "work," but the Left() function implies working with strings, so the correct syntax would be Left(Me.GCN, 1) = "9". I also assume, based upon additionial informaiton, that "9" indicates a National GCN? So, this issue only applies to National Clients, yes?

Me.txt_ClientCodeString - I assume this is a Text Box control on the Form? I cannot foresee a need to include the & vbNullString in your evaluation of this text value. Unless there is a particular need to add this value (which has a value of nothing).

Again, based on additional informaiton provided, if the GCN is a National Client and it has a Client Code, the DB deactivates it (I still don't know what you mean by "deactivating"). However, if there is no Client Code, you want to user to be forced to enter a Client Code and then the DB deactivates it (still don't know what that means--but not an issue at this point).

So, my questions would be:

How is this data entered? Does the user enter this data?

When (and how) does your form resort to the Code you have posted? Is it after the user updates the GCN? The ClientCodeString?

My apologies if it seems I am drawing this out. But, the better I understand your particular problem, the better able I am to guide you to an appropriate solution.
Feb 28 '18 #6

Post your reply

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