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

Control textbox to load data

9
Dear All,

I have question about control textbox.

example,

I have two textbox and have placed in the form(datasheet to show all table of data).

design layout if i use control source on the form such as the mention below

| number | status |
-------------------
| 1 | ok |
| 2 | ok |


but now there I want to make unbound for textbox,and without source to load table.

Expand|Select|Wrap|Line Numbers
  1. ----cut of code--
  2. Set rs = New ADODB.Recordset
  3. rs.Open "select * from sample order by id", CurrentProject.Connection, adOpenStatic, adLockOptimistic
  4.  
  5.         Do While Not rs.EOF
  6.             Me.text0 = rs!id
  7.             Me.text1 = rs!status
  8.         rs.MoveNext
  9.         Loop
  10.  
if i run, there only one row to show, so how to create with vba for control textbox like datasheet form to show all data. thanks
Jul 10 '14 #1
6 1354
twinnyfo
3,653 Expert Mod 2GB
You are only updating one record on your form, even if you have a thousand records in your table. Exactly what is the purpose of this code? Can't you achieve the same thing by using bound controls on here table?

If you want to do what you are doing, so that you can assign values from a different table or query to your form, you must keep the test boxes bound create a string for your SELECT statement and then assign the query to the record source of the form:

Expand|Select|Wrap|Line Numbers
  1. Me.RecordSource = strSQL
Hope this helps.
Jul 10 '14 #2
n3wkid
9
Can we assign the value without bound in the form (assign the value with vba)?
Jul 10 '14 #3
twinnyfo
3,653 Expert Mod 2GB
Yes, you can assign the value of an unbound form in VBA, but if you have multiple records, and cycle through assigning values, it will look like it is only assigning the last value in the recordset, even though it has updated it multiple times.

Hope that makes sense.
Jul 10 '14 #4
n3wkid
9
sorry sir,..can you show me how to make it(code in vba)?
i think i only need to make control textbox and assign the value after i create code for loading recordset so the form look such as datasheet.
Jul 10 '14 #5
twinnyfo
3,653 Expert Mod 2GB
I'm sorry I don't understand. I think you have the tools; I don't know what you are asking for. Assign the SQL String to the Recordsource of the Form, and if the form is in data sheet view, it should work. But, the controls need to be bound.
Jul 10 '14 #6
Jerry Maiapu
259 100+
Populating values of a combo box is different from bounding the value of a combo box to a table.

You can simply populate the combo values of Number & Status from a query by creating a query and assigning the values to the combo. You basically don't need VBA to produce what you are a trying to achieve.

Like twinnyfo said, you have all the tools you need at your disposal.

Thanks
Jul 10 '14 #7

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

Similar topics

14
by: Bruce A. Julseth | last post by:
When I execute this SQL statement in my PHP code, I get an error "File '.\Address.txt' not found (Errcode: 2)" $File = addslashes(".\Address.txt"); $SQL = "Load Data InFile \"" . $File . "\"...
0
by: Donald Tyler | last post by:
Then the only way you can do it that I can think of is to write a PHP script to do basically what PHPMyAdmin is trying to do but without the LOCAL in there. However to do that you would need to...
0
by: JohnLH | last post by:
Hi, I am having an issue with the LOAD DATA LOCAL FILE command on the latest 3.0.9 JDBC Driver. The command works on Windows, but doesn't seem to work on OSX and Linux. The error that I get on...
1
by: Ray in HK | last post by:
What are the differences between LOAD DATA INFILE and LOAD DATA LOCAL INFILE ? I found some web hosting company do not allow using LOAD DATA INFILE but allow LOAD DATA LOCAL INFILE. The reason...
1
by: Uthuras | last post by:
Greetings, Machine : Pentium IV Os Windows 2000 server Product : DB2 UDB Release : 7.2 We are fail to load the following data file format into db2 database table that has long varchar...
3
by: subaga | last post by:
Hi, I have to load data into a table with one of the columns defined as NOT NULL, but the file does not have data for it. i would like to load a constant value for this column and the constant...
3
by: nsh | last post by:
mailing.database.mysql, comp.lang.php subject: does "LOAD DATA" EVER work?!? I've tried EVERYTHING! version info: my isp is running my web page on a linux box with php ver. 4.4.1 according to...
0
by: lanesbalik | last post by:
hi all, right now i'm trying to migrate from db2 running under linux to mysql v5.1. i manage to export out the db2 structure & data into a del (ascii) file. but when i try to load the data...
2
by: wildman | last post by:
RE: Gridview textbox has data check without postback.. javascript? I have a gridview with a textbox. I can set the textbox to autopostback and check for a value in a prerender event to decide if...
0
by: Dwight Johnson | last post by:
I am just starting to use AJAX, and I've run into a problem that I cannot resolve. I have a text box, the third of three controls in an UpdatePanel. Here's the scenario: 1. I create all the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.