So I have a text box with a string in it, and I want to get the value
in that text box into a table using VBA but I have no idea how to do
that. Anyone offer any help? Thanks in advance! 5 1472
Zachary wrote:
So I have a text box with a string in it, and I want to get the value
in that text box into a table using VBA but I have no idea how to do
that. Anyone offer any help? Thanks in advance!
Look at AddNew method in help. (some other topics include
OpenRecordset, Update, FindFirst, and later on Edit). Of course, you
could also use an Append or Update query. Since you specified VBA, see
Execute in help as well if you want to use a query.
Perhaps http://www.youtube.com/watch?v=WaCK34LmvTE
Have you tried doing:
DoCmd.SetWarnings False
DoCmd.RunSQL("INSERT INTO 'table_Name' (column_Name) VALUES ("&
StringVariable &");")
DoCmd.SetWarnings True
The SetWarnings disable the "Are you sure that you want to insert X
new rows into the table XXX?" warning.
On 29 dic, 03:36, Salad <o...@vinegar.comwrote:
Zachary wrote:
So I have a text box with a string in it, and I want to get the value
in that text box into a table using VBA but I have no idea how to do
that. Anyone offer any help? Thanks in advance!
Look at AddNew method in help. (some other topics include
OpenRecordset, Update, FindFirst, and later on Edit). Of course, you
could also use an Append or Update query. Since you specified VBA, see
Execute in help as well if you want to use a query.
Perhapshttp://www.youtube.com/watch?v=WaCK34LmvTE
No one's asked the obvious, so I will: Is the textbox bound to the field in
the table?
--
There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000/2003
Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ccess/200712/1
If I understand you, I think that you're trying to do something like:
Dim i As Integer
Dim Cadena As String
Dim Valor As String
If IsNull(Me.textbox) Then Exit Sub
Cadena = Me.textbox.Value
DoCmd.SetWarnings False
For i = 1 To Len(Cadena)
Valor = ""
Do While (Mid(Cadena, i, 1) <",") And i < Len(Cadena)
Valor = Valor & Mid(Cadena, i, 1)
i = i + 1
Loop
DoCmd.RunSQL("INSERT INTO 'tabla' ('Columna') VALUES ("& Valor
&");")
Next i
DoCmd.SetWarnings True
On 31 dic, 17:03, rael <rae...@gmail.comwrote:
If I understand you, I think that you're trying to do something like:
* * Dim i As Integer
* * Dim Cadena As String
* * Dim Valor As String
* * If IsNull(Me.textbox) Then Exit Sub
* * Cadena = Me.textbox.Value
* * DoCmd.SetWarnings False
* * For i = 1 To Len(Cadena)
* * * * Valor = ""
* * * * Do While (Mid(Cadena, i, 1) <",") And i < Len(Cadena)
* * * * * * Valor = Valor & Mid(Cadena, i, 1)
* * * * * * i = i + 1
* * * * Loop
* * * * DoCmd.RunSQL("INSERT INTO 'tabla' ('Columna') VALUES ("& Valor
&");")
* * Next i
* * DoCmd.SetWarnings True
I make a mistake, the Do While Loop condition
i < Len(Cadena)
really it's
i < Len(Cadena) + 1 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sunny K |
last post by:
Hi guys,
I have a field in my DB called EventDate as a DateTime field,
therefore it holds both the date and time together like this:
'2004-10-14 08:42:57.000'.
I need to add together all the...
|
by: HolaGoogle |
last post by:
Hi all,
Please help me with the following..it's realy urgent and i tried
everything i could and i can't get it work properly!! Thanks in
advance.
Here's what i'm trying to accomplish:
in my...
|
by: Paul |
last post by:
Hi
I have a table that currently has 466 columns and about 700,000
records. Adding a new DEFAULT column to this table takes a long time.
It it a lot faster to recreate the table with the new...
|
by: Viorel |
last post by:
Adding new row with default values.
In order to insert programmatically a new row into a database table, without
direct "INSERT INTO" SQL statement, I use the well-known DataTable.NewRow,...
|
by: Jim Heavey |
last post by:
Trying to figure out the technique which should be used
to add rows to a datagrid. I am thinking that I would
want an "Add" button on the footer, but I am not quite
sure how to do that. Is that...
|
by: Aaron Ackerman |
last post by:
I have a bound combobox the appears on a cell within the column of my bound
grid when the user clicks on a cell n(In my vb.net WinForm app).
I am trying to allow the adding of an item to that bound...
|
by: Trevor |
last post by:
Hey,
I am trying to do this tutorial on the microsoft site :
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dndotnet/html/usingadonet.asp
I can get everything to work up to...
|
by: Rudy |
last post by:
Hi all,
I know this is easy, just can't seem to get it. I have a windows form, and
a text box, with a value already in it. I need to add that value to a table.
It's just one value, so the entire...
|
by: Miro |
last post by:
Im a VB Newbie so I hope I'm going about this in the right direction.
I have a simple DB that has 1 Table called DBVersion and in that table the
column is CurVersion ( String )
Im trying to...
|
by: john |
last post by:
In my form (table A) I have subform (table B (only 2 fieds: ID and App_name)
where table A -Table B are linked 1XM. To be able to add a record in the
subform I want to use a lookup form since the...
|
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,...
|
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$) {
}
...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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: 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...
| |