473,385 Members | 1,676 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 problem on a logon form

1
This is probably a simple and dumb question, but I am new (be gentle )



I have the following code
Expand|Select|Wrap|Line Numbers
  1. 'Check value of password in tblEmployees to see if this matches value chosen in combo box
  2.  
  3.     If Me.txtPassword.Value = DLookup("strEmpPassword", "tblEmployees", "[lngEmpID]=" & Me.cboEmployee.Value) Then
  4.  
  5.         lngMyEmpID = Me.cboEmployee.Value
  6.  
It works just fine. The problem I have is instead of getting the Employee's name (or number) from a combo box I want to get the same info from the form but from a text box.


On one of my attempts I created a text box named txtEmployee and changed the cbo in the above code to txt. I get various errors as I try different things I have looked and done some searching online and can not find an answer that I understand or can adapt to my code. I am new to VBA and wanting to learn more.

If you can help I would really apericate it
Sep 14 '06 #1
1 1917
PEB
1,418 Expert 1GB
HI

In your code obviously you want to use text /string/ as a value when you search the password...

IN VB the text is marked with " or '

So your code:

Expand|Select|Wrap|Line Numbers
  1. 'Check value of password in tblEmployees to see if this matches value chosen in combo box
  2.  
  3.     If Me!txtPassword = DLookup("strEmpPassword", "tblEmployees", "[lngEmpID]='" & Me!cboEmployee+"'") Then
  4.  
  5.         lngMyEmpID = Me!cboEmployee
  6.  
IF your Me!cboEmployee is a number so:

Expand|Select|Wrap|Line Numbers
  1. 'Check value of password in tblEmployees to see if this matches value chosen in combo box
  2.  
  3.     If Me!txtPassword = DLookup("strEmpPassword", "tblEmployees", "[lngEmpID]=" & str(Me!cboEmployee)) Then
  4.  
  5.         lngMyEmpID = Me!cboEmployee
  6.  
Have a nice day


This is probably a simple and dumb question, but I am new (be gentle )



I have the following code
Expand|Select|Wrap|Line Numbers
  1. 'Check value of password in tblEmployees to see if this matches value chosen in combo box
  2.  
  3.     If Me.txtPassword.Value = DLookup("strEmpPassword", "tblEmployees", "[lngEmpID]=" & Me.cboEmployee.Value) Then
  4.  
  5.         lngMyEmpID = Me.cboEmployee.Value
  6.  
It works just fine. The problem I have is instead of getting the Employee's name (or number) from a combo box I want to get the same info from the form but from a text box.


On one of my attempts I created a text box named txtEmployee and changed the cbo in the above code to txt. I get various errors as I try different things I have looked and done some searching online and can not find an answer that I understand or can adapt to my code. I am new to VBA and wanting to learn more.

If you can help I would really apericate it
Sep 16 '06 #2

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

Similar topics

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...
5
by: Kalvin Schroder | last post by:
I am fairly new to Access, and am trying to put together an invoice form. The main form in called InvoiceDetailFm. Source is the table InvoiceDetail and has invoice number, saleman, and CustID as...
1
by: mstery | last post by:
I have a report generated via an ID selection made in a dropdown on a form. The report filters by an on click event in a preview report button on the form. Everything in the report, including...
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 ...
6
by: Don Sealer | last post by:
I've written this expression for a DLookup function. It works almost alright. What I'm trying to do is type in a description and the ID field (number) populates automatically. It works almost as...
2
by: c.kurutz | last post by:
Hello everyone. I have a problem with looking up pricing. Here is what I have so far: TABLES tblItems: itemid itemdescription itemunit (each, roll, square foot) location1price
1
by: Lee | last post by:
I have an orders form which has orderID as the primary key, it also has supplierID as a foreign key located on the form. I need a lookup field (that looks up the account number which is located in...
5
by: hrreece | last post by:
I have a form, Master List Temp, in Access 2003 that uses the Dlookup command to pull values from another table, Address Master. The user types in a person's home phone number in the HomePhone field...
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...
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
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.