Hello Everyone,
Can someone show me how to insert data from a query into a text boxes on a form in access. I've been trying dlookup but can't seem to get it to work or understand what I'm supposed to do with it. I'm attaching a sample database. I'm trying to find a location in my query list that matches the location name of a text box then insert the data that is to the right of the location query field. So, location E1-B1 should have data 11-22 then place 11-22 in the text box named E1-B1 and so on. Any help or clues would be much appreciated
thx
E.
Last edited by enhydra; 06-09-2011 at 09:48 PM.
Oops, I guess I can't upload a database.
You should be able to upload your database. Check the size limitation. BE sure to run a compact and repair to make it minimum size. Click on the advanced button on your first thread and scroll down to manage attachments.
Some questions:
Is your form bound to a table?
Is your form bound to your query?
Are the text boxes you are trying to populate in the body of the form or in the footer or header?
Alan
Alan
Click the * below to say thanks.
Database Principles
Pivot Table Tips
Good Excel Video Tutorials
Sumifs or SumProduct
DataPig Access Tutorials
MS Query Tutorial
Worst Pie Chart Ever?
Had to zip it before it would except.
I don't know of any way to put multiple records from a table/query onto a single form. This can be done if you change your form to continuous view or datasheet view. If you choose either of those two suggestions, then you would only need two fields (controls) on your form and bind your form to your query. Perhaps there is someone else out in this forum with a better idea.
Alan
Edit: You could possibly present the data you want in an Access Report using the Query as your record source.
Last edited by alansidman; 06-07-2011 at 02:00 PM.
Alan
Click the * below to say thanks.
Database Principles
Pivot Table Tips
Good Excel Video Tutorials
Sumifs or SumProduct
DataPig Access Tutorials
MS Query Tutorial
Worst Pie Chart Ever?
Here is a way to fill those textboxes:
If you put an entry in the table that has no corresponding textbox, you will get an error.Private Sub Command55_Click() Dim rs As Recordset Set rs = CurrentDb.OpenRecordset("Data", dbOpenTable) rs.MoveFirst Do Until rs.EOF Me.Controls(rs!LocLeft & "-" & rs!LocRight).Value = rs!DataLeft & "-" & rs!DataRight rs.MoveNext Loop Set rs = Nothing End Sub
Is your code running too slowly?
Does your workbook or database have a bunch of duplicate pieces of data?
Have a look at this article to learn the best ways to set up your projects.
It will save both time and effort in the long run!
Dave
Thank you Dave. That's work well. I don't think it will matter with the "no corresponding textbox" because there will always be more boxes then entries. I add an extra row of boxes and no errors. Looks good to me. This is my first attempt at moving my excel project to access.
mucho appreciated.
E.
You're not using those text boxes to mimic cells are you? Use a datasheet in the form instead (as alansidman said). Access is different than Excel - it stores and manipulates data more efficiently, but the calculations that a user may want to make need to be set up beforehand, usually with programming.
Is your code running too slowly?
Does your workbook or database have a bunch of duplicate pieces of data?
Have a look at this article to learn the best ways to set up your projects.
It will save both time and effort in the long run!
Dave
No, they are being used just as you see them, a text box, to display text right from a table.
E.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks