View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default Excel UserForm to Collect Data for Access

I just got it (from the Access Programming DG):
Private Sub btnSendToDB_Click()
Dim usrName As String
Dim dbConnection As ADODB.Connection
Dim recordSet As ADODB.recordSet
Dim strSQL As String

Set dbConnection = New ADODB.Connection
Set recordSet = New ADODB.recordSet
'The variable that'll hold the data within txtBoxName
usrClient = Me.txtBoxName.Value

strSQL = "INSERT INTO tblClients ([Clients]) VALUES ('" & usrClient & "')"

dbConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source
=C:\Documents and Settings\rshuell\Desktop\Access Models\Diego_Reports.mdb"
dbConnection.CursorLocation = adUseClient

' This will open up the recordSet, using the SQL statement and the
dbConnection - Connection.
recordSet.Open strSQL, dbConnection

'Close of the connection.
dbConnection.Close
Set dbConnection = Nothing

End Sub

Hope this helps others.......



Regards,
Ryan---

--
RyGuy


"Dick Kusleika" wrote:

On Tue, 27 May 2008 22:33:00 -0700, ryguy7272
wrote:

I am trying to come up with a way of linking to an Access DB, via an Excel
interface, such as a UserForm, because many people in my firm do not have
Access installed on their workstations. Im sure this is possible, but I
dont know the best way to approach the problem. Im thinking of posting the
Excel UserForm on our firms Intranet (WAN or LAN), and then ask users to
open the UserForm, input some basic information, and then save the changes
and so on and so forth. Is there some way to do all of this on a LAN or a
WAN? Could the Excel file reside on a public network drive, and
automatically download to am Access DB every time there is a chance (i.e.,
each time a user inputs something into the UserForm)? I would appreciate any
and all help with this project.


Here's a tutrorial that will help get you started, but it doesn't write back
to the database.
http://www.dailydoseofexcel.com/arch...erform-part-i/

--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com