Re: create access xp table from textbox string in vb6

  • From: "Bryan Schulz" <b.schulz@xxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Tue, 7 Apr 2009 09:59:48 -0500

hi,

it worked with getting the textbox control outside of the quotes like:
conn.execute "insert into " & txtPlayerName.text & " values"
but i still ran into errors until the space between first and last name was replaced with an underscore.

Bryan Schulz
The BEST Solution
www.best-acts.com

----- Original Message ----- From: "Dragan Miljojcic" <gagabim@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Tuesday, April 07, 2009 6:43 AM
Subject: Re: create access xp table from textbox string in vb6


Hello,

try this:
conn.Execute "CREATE TABLE " _
& chr(39) & strPlayerPicksTable & chr(39) _
& "(Empl...

Dragan.
----- Original Message ----- From: "Bryan Schulz" <b.schulz@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Monday, April 06, 2009 10:24 PM
Subject: create access xp table from textbox string in vb6


hi,

anyone on here know how to create a table based on textbox text?
say if the text box contains john smiths picks,
i want to add a table called john smiths picks to the access 2002
database.
i have a sample block of code but the results end up creating a table
called strPlayer table instead of the player's name.

i tried putting the control outside of the quotes like:
conn.Execute "CREATE TABLE " &
strPlayerPicksTable
then the rest of the string but it causes errors.

Sub AddTable()
Dim db_file As String
Dim conn As ADODB.Connection
Dim RS As ADODB.Recordset
Dim num_records As Integer
Dim strPlayerPicksTable As String
strPlayerPicksTable = txtPlayerName.Text

' Get the database name.
db_file = App.Path
If Right$(db_file, 1) <> "\" Then db_file = db_file & "\"
db_file = db_file & "NCAA-tourney.mdb"

' Open a connection.
Set conn = New ADODB.Connection
conn.ConnectionString = _
   "Provider=Microsoft.Jet.OLEDB.4.0;" & _
   "Data Source=" & db_file & ";" & _
   "Persist Security Info=False"
conn.Open

' Drop the player picks table if it already exists.
On Error Resume Next
conn.Execute "DROP TABLE strPlayerPicksTable"
On Error GoTo 0

' Create the player picks table.
conn.Execute "CREATE TABLE strPlayerPicksTable(EmployeeId INTEGER NOT
NULL, LastName VARCHAR(40) NOT NULL, FirstName VARCHAR(40) NOT NULL)"

' Populate the table.
   conn.Execute "INSERT INTO " & strPlayerPicksTable & "VALUES (1, " & _
       "'Anderson', 'Amy')"
   conn.Execute "INSERT INTO " & strPlayerPicksTable & "VALUES (1,
'Baker', " & _
       "   'Betty')"
   conn.Execute "INSERT INTO " & strPlayerPicksTable & "VALUES (1,
'Cover', " & _
       "   'Chauncey')"

   conn.Close
End Sub

Bryan Schulz
The BEST Solution
www.best-acts.com

----- Original Message ----- From: "Ricks Place" <OFBGMail@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Monday, April 06, 2009 2:30 PM
Subject: Re: learning .net


You can get the .exe in the BIN folder of the project after it is
complete.
Rick USA
----- Original Message ----- From: "Robert Montowski" <r_montowski@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Monday, April 06, 2009 1:00 PM
Subject: Re: learning .net


Hello there,
When using the express editions of visual studio..if I create a VB.net
program...
can it be compiled down to a .EXE file that I can share with others?
or is this like the student version of visual basic 6 tht I have that
can let me create a program, run the program in the VB environment but
*not* compile it down to a .EXE that I can share?
thanks for any help you can offer.
Robert

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind



__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: