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

How do I bind a textbox after a query?

I have one listbox and two textboxes. The listbox successfully populates with rows from a table. When the listbox is clicked, two values from that row are inserted into the textboxes.

When one of the textboxes is edited, those values are not saved back into the table, obviously. After the listbox is clicked, I want to be able to bind the textboxes to the table. I am not sure how to do this.

Below is my code to populate the two textboxes:
Expand|Select|Wrap|Line Numbers
  1. Private Sub lstRWASWA_AfterUpdate()
  2. Dim strSQL As String
  3. Dim rst As ADODB.Recordset
  4. Set rst = New ADODB.Recordset
  5.  
  6. strSQL = "SELECT RWACost, RWADescrip FROM tblRecurring WHERE RWANum = '" & Me.lstRWASWA & "';"
  7.  
  8. rst.ActiveConnection = CurrentProject.Connection
  9. rst.CursorLocation = adUseClient
  10. rst.Open strSQL
  11.  
  12. txtRWACost = rst("RWACost")
  13. txtRWADescrip = rst("RWADescrip")
  14.  
  15. rst.Close
  16. Set rst = Nothing
  17.  
  18. End Sub
  19.  
Jan 4 '11 #1
1 2254
I ended up using queries insead. this thread can be closed.
Jan 6 '11 #2

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

Similar topics

0
by: Patrick De Ridder | last post by:
I posted this query before, but am not seeing it listed. If I enter a return in a text entered into a textBox, the rest of the text gets lost after a write textBox.Text and a read textBox.Text....
2
by: OldNewbie | last post by:
Hello All I have a textbox control. I would like this text box to automatically update to contain the currently selected item located in a listbox which is on the same form. Do I need a...
3
by: MrMike | last post by:
Hi. I have a dataset on my webform which I successfully fill by calling a Sub that occurs after the Page_Load. My question is - I have a textbox control which I need to populate with the contents...
0
by: rbutch | last post by:
hey guys got a question. im trying to bind a textbox "at runtime". im creating the conn string, dataset, dataAdapter etc dynamically. and it keeps erroring out. <asp:TextBox ID="txtDay1"...
1
by: Adam J Knight | last post by:
Hi all, I am assuming there may be a number of ways to bind a text box to a db field using c#. My current approach is: txtPostCode.Text = rdrInstitution.ToString(); Can anyone let me if...
1
by: truckin | last post by:
can someone help me do the following. example: I want to type into a text box from a form and it enters a query to google(using google as an example) for feedback into a datagrid. thanks
0
by: Gunawan | last post by:
Hi All, public class clsITextBox : ITemplate { string controlName = ""; object dataSource = null; string fieldName = ""; public clsITextBox(string controlName, object dataSource, string...
3
by: raamay | last post by:
I have a module where i have specified the connection string as below: Public Function Connection() As String Return "Data Source=192.168.0.1,1433;Network Library=DBMSSOCN;Initial...
2
by: akshalika | last post by:
Hi, I have a repeater control. it dynamically bind textbox or dropdown base on some condition. i want to bind required field validator dynamically for validate textbox or dropdown. here is my...
0
by: naeemmalik | last post by:
i have a WPF TextBox user control in my win forms applications. when i want to bind it to the data in datagridview, the DataBindings.Add property is not shown in the intellisence. How to add...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.