473,385 Members | 1,402 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,385 software developers and data experts.

Dlookup?

Hello,

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) = ""
  6.  
  7.         Exit Sub
  8.     End If
  9.  
  10.  
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
5 1137
twinnyfo
3,653 Expert Mod 2GB
ivonsurf123,

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
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.

Cheers!
Feb 28 '18 #3
twinnyfo
3,653 Expert Mod 2GB
Ivon,

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.

Thanks.
Feb 28 '18 #4
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
twinnyfo
3,653 Expert Mod 2GB
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

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

Similar topics

1
by: KLAU | last post by:
I have a field that retrieves information from an expression in a query. I have used a DLookup function to get the calculated field from the query. However, the relationship is 1-to-many so one...
6
by: JLM | last post by:
What am I missing here? I have a form where I enter a "Class Code". This value corresponds to what sits in table "class code descriptions" along with the "title" of each "class code." Key...
4
by: MLH | last post by:
I have tried using DLookUp in this manner... If DLookUp("","tblClients","='2021234567'") Then MsgBox "Found it!" End If I am wondering if that is a misuse of the DLookUp command? Type...
2
by: ctyrrell | last post by:
I have read with interest the many discussions of the 3048 Error: Cannot open any more databases. I understand how the number of open Table ID's causes the problem. My question has to do with the...
8
by: Christine Henderson | last post by:
I have a problem using the above function in the following simplified circumstance: In the lookup table called "Klms Travelled" I have 3 fields, eg: Receiver Name Receiver Suburb ...
11
by: MLH | last post by:
DLookup("", "tblPreliminaryVINs", "=Forms!frmVINODO!SerialNum") is giving me a Type Mismatch error. That's confusing to me and I don't know how to circumvent it. The field in...
2
by: Don | last post by:
Can someone help me fix my DLookup problem. I'm far from proficiency with Access. I've been creating databases for several years for work with the help of many of you and trial and error. I have...
9
by: | last post by:
In my database I have a 'control table' in which basic info is stored about the application, for instance the application's path and the name of the company that is using it. In all of the...
15
by: rleepac | last post by:
This is a little complicated but I'll do my best to explain. In my db I have a table called L_AgeCorrection which has the following fields: Age, Sex, Frequency, AgeValue This is a table used to...
8
by: JDaly | last post by:
This bombs on the StPL= line. I want it to look up a string value from a table with a criterion of matching another string. In immediate mode the form evaluates correctly with ? Form!! as TEST but...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.