View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
heavenlyhost1 heavenlyhost1 is offline
external usenet poster
 
Posts: 8
Default Not sure this should be Excel or ACCESS

Did you want me to send you anything else? Thank you so much for your time
and attention to this.

"Mike" wrote:

Yes your right again about the module in excel being a Macro.
As far as the report in access in concerned you dont need it.

"heavenlyhost1" wrote:

Thank you Mike. The ACCESS database name is RedCross-Volunteers, the Report
name in ACCESS is "Percentage of Tracking Returned (by date)", and the field
in that report is "Total Submitted". By excel module, is that a macro?

"Mike" wrote:

Your correct in saying change the names as indicated. You need to put this
into a excel module. This would be all you need. You would not need the
Access report.
If you could give me the your databasename, the name of the field I could
get it so you could work with it.

"heavenlyhost1" wrote:

Thank you for your time in doing this. I am unfamiliar with sql, if this is
what your formula is, so do I copy this (changing the names as indicated)
into an event somwhere in my ACCESS report (the DAte Submitted count is in
the report)? Do I copy the whole thing there? As you can tell, I really
require a ton of help, so if you don't have the time for this, I understand.

"Mike" wrote:

This should get you started
Private Sub getField()
'Needs reference the Axtive X Library 2.0 or higher
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sSQL As String, strConn
Dim rowNumber As Long

'C:\PathToYourMdb\Ilsa.mdb (Change)
strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\PathToYourMdb\DatabaseName.mdb;Persist Security Info=False"
'sSQL = "Replace with your query"
sSQL = "SELECT Field1 From TableName"

Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset

cnn.Open strConn
rs.Open sSQL, cnn, adOpenStatic, adLockOptimistic
rowNumber = 2 'Starting Row Number for data
Do While (Not rs.EOF)
Range("A" & rowNumber) = rs.Fields("Field1").Value
rowNumber = rowNumber + 1
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
cnn.Close
Set cnn = Nothing
End Sub

"heavenlyhost1" wrote:

I have a report in ACCESS where the user enters a start date and end date of
the 'Date Submitted' field in the table. The report then gives the total
count of records that that are generated between two given dates. I have an
excel report where I would like this total count to go to when the excel
report is opened. I've tried the ODBC thing and link thing but can't seem to
get this one field to plug into the excel spreadsheet. Can this be done?