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

Text Box to Table

158 100+
How would i go about taking the text out of txt1 and place it in a table with a column header textbox1 when i press cmd1

Thanks!
Aug 15 '08 #1
9 1517
janders468
112 Expert 100+
There are a few ways you could do it, but I would probably place this into the click event for the button:
Expand|Select|Wrap|Line Numbers
  1.     DoCmd.RunSQL "INSERT INTO tablename (textbox1) SELECT '" & me.txt1 & "'";
  2.  
Aug 15 '08 #2
Jollywg
158 100+
There are a few ways you could do it, but I would probably place this into the click event for the button:
Expand|Select|Wrap|Line Numbers
  1.     DoCmd.RunSQL "INSERT INTO tablename (textbox1) SELECT '" & me.txt1 & "'";
  2.  
Thanks for the help that worked wonderfully. Now my next question is how do i get a name from a query to the textbox?
Aug 15 '08 #3
janders468
112 Expert 100+
It depends on the query, could you post the sql for your query and I'll incorporate that into an example on how to do it.
Aug 17 '08 #4
Jollywg
158 100+
It depends on the query, could you post the sql for your query and I'll incorporate that into an example on how to do it.
Here is the query

SELECT MasterZip.Territory AS Territory, Count(MasterZip.[ZIP Code]) AS [CountOfZIP Code], Sum(MasterZip.MVRs) AS SumOfMVRs, Sum(MasterZip.Outlets) AS SumOfOutlets
FROM MasterZip
GROUP BY MasterZip.Territory
HAVING (((Left([MasterZip].[Territory],4))=[Please enter the Territory Number]));
Aug 18 '08 #5
janders468
112 Expert 100+
I should also have asked, what field are you interested in populating the textbox with?
Aug 18 '08 #6
Jollywg
158 100+
I should also have asked, what field are you interested in populating the textbox with?
the textbox names are txtTerritory, txtMVR, txtOutlets. Is this what you're talking about?
Aug 18 '08 #7
janders468
112 Expert 100+
Using a parameterized query makes this difficult, but typically if all you are returning is one value then I find a dlookup the best way to go. A dlookup takes two required parameters and one optional. The first is the field that contains the value you are interested in, the second is the table or query the field is contained within, and the the third is an optional criteria, it then returns the value from the field you specified in the first argument based on the result set of the query. In your case you can use your existing query. The only change you would have to make is instead of passing it the parameter of [Please Enter the territory number] you will need to give it that value such as from a textbox or some other input control on the form, then place the value of that control in your HAVING clause
Expand|Select|Wrap|Line Numbers
  1. HAVING (Left([MasterZip].[Territory],4))= RelevantControlValue));
  2.  
Assuming that once this query is constrained to a territory it only returns one record then you can return any value from any of the fields for instance (assume your query is named query1):

Expand|Select|Wrap|Line Numbers
  1. txtTerritory = dlookup("[Territory]","Query1")
  2.  
Aug 19 '08 #8
Jollywg
158 100+
ok I'll give it a try. Thanks!
Aug 19 '08 #9
janders468
112 Expert 100+
Let me know if you have questions, there are several simple things that could cause this to fail, so if it doesn't work we can certainly work through that.
Aug 19 '08 #10

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

Similar topics

7
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to...
8
by: BiNZGi | last post by:
Hi I have reduced the problem to this code: <form> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td><input type="text" style="width: 100%;" value="Lorem ipsum dolor...
6
by: Kevin Chambers | last post by:
Hi all-- In an attempt to commit an Access MDB to a versioning system (subversion), I'm trying to figure out how to convert a jet table's metadata to text, a la SaveAsText. The end goal is to...
9
by: sellcraig | last post by:
Microsoft access 2 tables table "data main" contains a field called "code" table "ddw1" is created from a make table query of "data main" Goal- the data in "code" field in needs to...
3
by: acecraig100 | last post by:
I am fairly new to Javascript. I have a form that users fill out to enter an animal to exhibit at a fair. Because we have no way of knowing, how many animals a user may enter, I created a table...
3
w33nie
by: w33nie | last post by:
I want to disable the text boxes, captain_name and captain_email, but only if the radio button, captain_guarantee, has NOT been checked. how do i do this? <form name="formTeamApplication"...
13
by: =?Utf-8?B?S2VzdGZpZWxk?= | last post by:
Hi Our company has a .Net web service that, when called via asp.net web pages across our network works 100%! The problem is that when we try and call the web service from a remote machine, one...
13
by: Stevo | last post by:
I've found that for IE6+, if you add the property text-align:center to a DIV, then *anything* inside it gets centered. That can be a table, an object/embed, another DIV, an image, or some text. ...
1
by: semomaniz | last post by:
I have a form where i have created the form dynamically. First i manually added a panel control to the web page. Then i added another panel dynamically and inside this panel i created tables. I have...
3
by: happyse27 | last post by:
Hi All, I wanted to align the text box for user registration but the code just wont budge... Kindly advise what is wrong? Cheers... Andrew <HTML>
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: 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
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.