473,406 Members | 2,208 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,406 software developers and data experts.

I am using Dlookup in a form to retrieve data from the table in a text box. My key fi

Driver's database= table
Driver' Name= Text value
Main Query= name of form
Combo 102: Driver's Names are stored here
IC No: Numeric value

Expand|Select|Wrap|Line Numbers
  1. =DLookUp("[IC No]","[Driver's database]","[Driver's Name]=" & [Forms]![Main Query)]![Combo102])
Please assist me
Oct 10 '14 #1
12 2737
jimatqsi
1,271 Expert 1GB
Irsian,
welcome to Bytes.com.

Please do not use the subject line to state your entire problem. Your subject got cut off and cannot be read.

Your problem appears to me to be a failure to put the driver name in quotes. Because it is a string value you must include it as a quoted string. Try this change.

Expand|Select|Wrap|Line Numbers
  1. =DLookUp("[IC No]","[Driver's database]","[Driver's Name]='" & [Forms]![Main Query)]![Combo102]) & "' "
Jim
Oct 10 '14 #2
zmbd
5,501 Expert Mod 4TB
By, simply stating that your code "doesn't work," along with posting code that appears to have had very little if any troubleshooting performed, and expecting someone to help doesn't usually result in much of an answer and may result in your thread being deleted. Instead, please tell us what you were expecting to happen, what actually happened.
Oct 10 '14 #3
Thanks for you prompt suggestion for being a new user
Thank you so much bro for answering on my issue. I used your code but its not retrieving the data. Passes only #Error. I did check all the field names and spelling mistakes but still receiving #Error.
Please assist me accordingly
Oct 11 '14 #4
I am using this function on a form to retrieve text data from the table using combo box.
Expand|Select|Wrap|Line Numbers
  1. '[z{Stepped code, it will not work w/ direct cut and paste}]
  2. =DLookUp("[IC No]",
  3.    "[Driver's database]",
  4.    "[Driver's Name]='" & 
  5.       [Forms]![Main Query]![Combo285]) & 
  6.          " ' "
Error is: #Error
Please help out me.
Thanks
Oct 11 '14 #5
jforbes
1,107 Expert 1GB
Hey There,
Using a Single Quote will give you crazy errors like the one you are experiencing. Spaces can also throw you for a loop, but they aren't as big as a problem as Single Quotes.
First thing I would do is rename [Driver's database] to[DriverDatabase] and rename the column [Driver's Name] to [DriversName]. You might also want to consider renaming your Form to [MainQuery]. Lastly, there is an extra space before your last single quote

If you were to rework all those things, the following might work:
Expand|Select|Wrap|Line Numbers
  1. Me.txtSomeTextbox.Value = DLookup("ICNo", "DriversDatabase", "DriversName='" & Forms!MainQuery!Combo285.Value & "'"
Oct 11 '14 #6
zmbd
5,501 Expert Mod 4TB
#Error in a calculated control usually indicates a syntax error in the formula, formula itself returned an error, or the use of the formula is not appropriate for the control.

Don't use the dlookup() in a combobox - this will not work as expected

You must understand the nature of a combobox:
Customize a list box, combo box, or drop-down list box

Typically, one has a table with a one to many relationship with another table and you want to show the human readable text from the second table such as:

[tbl_parent]
[PK](autonumber)
[fk_comboboxlist](numeric(long))
{other fields}

[tbl_comboboxlist]
[PK](autonumber)
[description] (text(25)]

So you have a form such that:

Expand|Select|Wrap|Line Numbers
  1. {form title}
  2. {label}   {label2}    {lable3}
  3. {textbox} {combobox2} {textbox3}
  4.  
You want the {combobox2} to show the
[tbl_comboboxlist]![description] value however because the
[tbl_parent]![fk_comboboxlist] is long the {combobox2} needs to actually have the [tbl_comboboxlist]![PK] as its value.

The simplest method is done by:
Set {combobox2} control source to [tbl_parent]![fk_comboboxlist]
Set {combobox2} row source type to "table/query"
Set {combobox2} row source to [tbl_comboboxlist]
Set {combobox2} bound column to 1
Set {combobox2} number of columns to 2
Set {combobox2} column widths to 0,1

The tutorial above will give much more detail.

What you have to keep in mind is that the bound column is the value that will be returned from the rowsource property to the control source. If it is blank, then your combobox is returning nothing. You need to have it set to the [field] of data in the rowsource that is required in your recordset.

It is very important that you understand that the CONTROL SOURCE is NOT the same as ROW SOURCE in a combo/list box. Normally the two are only related in that the bound column of the ROW SOURCE must return a value that is of the correct typecast as the field to which the cbo's CONTROL SOURCE is set (bound).

There is another method with multi-column record sources that you could use read thru this: How to select Records in an Access Subform from a Combo Box it's a bit of an overkill so don't worry if you don't follow somehthing, just ask back here and we'll clear it up (^_^)
Oct 11 '14 #7
zmbd
5,501 Expert Mod 4TB
jforbes, looks like we cross posted.
I saw those same errors; however,
[IR]: retrieve text data from the table using combo box.
gives me the impression that irslan is attempting a look-up field at the form level.

I guess that is something we should confirm instead of me just guessing, (^_^)

@irslan: My last post is based on a guess that you are attempting to create a look-up field in your form.

Lookup fields at the query and form level are very common place and where their use is, as a best practice, limited to.

Unless you are going to publish to a SharePoint-Site then the following describes how many (and I dare say most access developers feel about): The Evils of Look-up Fields in Tables. Once again, IMHO, at the table level, the only legitimate time to use a look-up field is for SharePoint interactions.
Oct 11 '14 #8
jforbes
1,107 Expert 1GB
Right On. I didn't catch the ComboBox as the Target.
Oct 11 '14 #9
Once again thanks for your prompt reply. Very sorry coz I am new to Access:
I have one main table where i m having few fields:
I made a query on main table and then made a form on query.
On the form i made a combo box where the drivers' name are called from another table and made them to save in main table. So i want, when i select driver's name from the combo box, it should retrieve IC No in a text box on a only form and at the same time show the same driver's name in the driver's name field.(its working)
But cannot retrieve IC no on selecting drivers's name.
Fields in main table:
Driver's Name (Text)
IC No(Numeric)

It is very humbly requested that please solve my problem.

Thanks
Oct 11 '14 #10
zmbd
5,501 Expert Mod 4TB
irslan:
Then you have exactly the situation I've described in post#7.

Please follow the links therein and work thru it's tutorial section. It will describe step by step what you need to do.

If you still do not follow post#7.

then perhaps a more detailed explanation is required:
Access Tutorial 8: Combo Box Controls (PDF - Print and save (^_^) ) This article will show you everything you could possibly want to do with the combobox and perhaps more.

Respectfully, we will not do the work for you.

-z
Oct 11 '14 #11
Thanks a lot bro for giving a clear view using a combo box. So skipping a combo box, i want to use a text box instead of combo box. User just write the name of driver and related details come out. Can u write that dlookup function for me to retrieve string from the table.
All other scenario is same.
Thanks and assist me.
Oct 11 '14 #12
Hi,

GOT IT by playing the Dlookup, described u earlier,
FOR TEXT:
Expand|Select|Wrap|Line Numbers
  1. =DLookUp("[ICNo]","[Drivers]","[DriversName]='" & [Forms]![Main]![Text18] & "'")

FOR COMBO:

Expand|Select|Wrap|Line Numbers
  1. =DLookUp("[ICNo]","[Table1]","[DriversName]='" & [Forms]![Drivers Query]![Combo11] & "'")
Thanks indeed. It was my first experience to ask something on the forum. I am really grateful to both of you(ZMBD and JFORBES)for prompt assistance. Take care and bye
Oct 12 '14 #13

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

Similar topics

6
by: Jocknerd | last post by:
I'm a Python newbie and I'm having trouble with Regular Expressions when reading in a text file. Here is a sample layout of the input file: 09/04/2004 Virginia 44 Temple ...
1
by: Methven | last post by:
File - Get External Data - Import - Text Type - Advanced - Specs PROBLEM Can anyone assist me with a problem ? When attempting to specify an import specification using ; File - Get External...
5
by: ggk517 | last post by:
We are trying to develop an Engineering application using PHP, Javascript with Informix as the back-end. Is it possible to retrieve data using Javascript but by accessing the Database. Say...
1
by: jpabich | last post by:
I am trying to retrieve an Oracle Time stamp with time zone information. Somewhere between Oracle and .NET, it is dropping this data. Can you tell me how to retrieve it?
10
by: Gerhard | last post by:
Hi, all I run into the same problem on Access 2000 and 2003. Hopefully someone can replicate it – or not. 1. Create an unbound form – call it Form1. 2. Insert two unbound text boxes –...
1
by: dillip132 | last post by:
Q.no 1---if we have three text box, with same name "uname" How can i retrive data from these three text boxes using Jsp.
3
reginaldmerritt
by: reginaldmerritt | last post by:
I'm using Dlookup to search a table for the first record it comes across that has a date >= the date i specifiy. e.g. formateddate = format(Me.SelectedDate,"mmddyy") VarX = DLookup("",...
12
lifeisgreat20009
by: lifeisgreat20009 | last post by:
I am a newbie to Struts and JSP...I have been working on the code below for 5 hours now..I googled a lot but couldn't get much help so finally I am here.. Hoping of getting my problem solved. Please...
2
by: toadmaster | last post by:
I am trying to get an onclick event to open a form based on the logged in username from Windows. The idea is to open either form A or B after I have used DLookup to check a table to see if the...
8
by: toadmaster | last post by:
Help I am stumped; I am trying to get DLookup to use the email value from another table if a user does not exist in the first table. i = DLookup("email", "Member", "windowsname = text114") If i...
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: 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...
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...
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,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.