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

Access 2010 - DLoolup Show Results Values in Texbox on its own line multiple columns

gcoaster
117 100+
Hello Group
what i am trying to occomplish something i cannot find no matter how hard i search! maybe i am not wording it right.

I would like to use DLookup to show results values from a table and display in a unbound textbox on a form. the results from each column in the table need to be on seperate lines, a break if you may. Here is the code I have so far.

Expand|Select|Wrap|Line Numbers
  1. txtKeywords = DLookup("colKeyword", "tblKEYWORDS", "cboCategory = '" & txtcategories & "'")
  2.  

In colKeyword Column In tblKEYWORDS table match what i select in cboCategory Combo drop down box and populate txtcategories textbox on form

What I would like to do is show All colKeyword results in textbox [txtcategories] and display each result on its own line!

example

entry1
entry2
entry3
entry4


Thank you for your time
Mar 27 '14 #1

✓ answered by Seth Schrock

I'm a little confused by your question. Are you doing multiple DLookups and you want the results from each to be on a separate line? DLookup can only return a single value, but it sounds like you only have one DLookup. If you are doing multiple DLookups, then you might try using a recordset instead as domain functions (DLookup, Dcount, etc.) are resource intensive and can slow your program down with excessive use.

So, no matter how you are getting the different lines of information (or entries from your example), the way to put them are their own line is to concatenate the vbCrLf constant into the string. Something like this:
Expand|Select|Wrap|Line Numbers
  1. Me.txtCategories = "Entry 1" & vbCrLf & "Entry 2" & vbCrLf & "Entry 3"
  2.  
  3. Produces...
  4.  
  5. Entry 1
  6. Entry 2
  7. Entry 3
So the question now becomes how are you getting your bits of entry information.

4 1565
Seth Schrock
2,965 Expert 2GB
I'm a little confused by your question. Are you doing multiple DLookups and you want the results from each to be on a separate line? DLookup can only return a single value, but it sounds like you only have one DLookup. If you are doing multiple DLookups, then you might try using a recordset instead as domain functions (DLookup, Dcount, etc.) are resource intensive and can slow your program down with excessive use.

So, no matter how you are getting the different lines of information (or entries from your example), the way to put them are their own line is to concatenate the vbCrLf constant into the string. Something like this:
Expand|Select|Wrap|Line Numbers
  1. Me.txtCategories = "Entry 1" & vbCrLf & "Entry 2" & vbCrLf & "Entry 3"
  2.  
  3. Produces...
  4.  
  5. Entry 1
  6. Entry 2
  7. Entry 3
So the question now becomes how are you getting your bits of entry information.
Mar 27 '14 #2
gcoaster
117 100+
Hello Seth,
Thank you for your time.

I guess I am trying to do a =DLookup to pull out a columns data in a table that matches a particular category and populate a unbound textbox on a form - each value on its own line.

For instance if I select "Bytes" from combobox
then the dlookup would show me all of the entries in the table that have the category "Bytes" and then populate the textbox.

result would be in the txtbox

Database Geniuses
access databases
Database Heroes



Thank You
Mar 27 '14 #3
Seth Schrock
2,965 Expert 2GB
DLookup cannot pull an entire column that matches your criteria. It will only return the value in the field specified for the first record that it finds that does match your criteria. It sounds like you would benefit from using a recordset and then looping through it to add the different records into the textbox. Then again, it may be simpler to just use a subform, unless there is a reason that you need all your data in one textbox (which won't allow edits to be saved).
Mar 27 '14 #4
gcoaster
117 100+
Thanks Seth, Now i understand DLookup
Dont need a subform, no need to edit the data. Nothing is simple in Access!

Ok, A recordset and then looping through it
Mar 27 '14 #5

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

Similar topics

1
by: Angel Pacheco | last post by:
How do I make my results from my program to show 6 values each line? int main() { int counter; counter = 100; while (counter <= 150) { cout << counter << endl; counter =...
17
by: M0ji | last post by:
I have started creating a database (There is only one table as of now). The database is meant to store information about "technical requirements" in an industry. Each row corresponds to one...
1
by: FAJACOBS | last post by:
Hi all, I am attempting to use Access 2010 to split out a single cell with multiple variable data points. For example it may contain There may be up to 7 entries, with quantities, but where there is...
3
by: time2hike | last post by:
Hi, I have a query that pulls in hours for multiple Subprojects by Month and Year. To be able to compare data I need to Count the Month & Year for each subproject. Example Subproject1 11/2011 would...
4
by: RedGoldPhoenix | last post by:
Hi I wish to migrate DDL from DB2 to ACCESS 2010 So I delete "CREATE DATABASE" , "CREATE TABLESPACE" change " FOR SBCS DATA NOT NULL," in " NOT NULL," Delete line which contains "SET CURRENT"...
1
by: jdks2006 | last post by:
I work with a company who is needing to use Access 2010 to receipt in checks for paid invoices. Our issue came when our auditor found we had duplicate receipt numbers using serial numbered receipt...
4
by: vbissues | last post by:
I am trying to understand how to write VB code in Access 2010 to automatically populate the data into multiple excel spreadsheets. The data in the query encompasses all the data (by manager), but I...
9
gcoaster
by: gcoaster | last post by:
Hello Group I need help, I need to use an to show results values from a table and display in a unbound textbox on a form. the results from each column in the table need to be on seperate...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.