Export Multiple Subforms in one Sub

raider34

New member
Local time
Today, 13:03
Joined
Jun 16, 2014
Messages
6
Hi there, I've searched for hours on this site for answers to this question.. and no luck.. only a boblarson code that helps for maybe one subform, and i don't completely understand how it works.

I've got a Main Form with :combobox "Name" that changes subform results
: Subform w/ container name "subform34"
: Subform w/ container name "subform35"
............................. "subform36"

I want to be able to do the following for each subform:


Me.subform34.SetFocus
DoCmd.GoToControl "Field1"
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.RunCommand (acCmdCopy) ***


Except for starred line, I'm thinking I could save the records as Long, I don't really know.

Someone brought up the possibility of writing SQL to generate a query then export the query.. but don't know

Pls help.
Pls
I'm scared
 
Someone brought up the possibility of writing SQL to generate a query then export the query
This sounds like the way to go, if records are available through a sub form, then those same records can be queried using your subform linking criteria. You don't say what you're trying to do with the copied records, if you can expand on this, may be able to help.

David
 
Extra Info For ya

David,

The 3 subforms each hold about 10 records of Oil Well data each, and the goal is to export them to the same excel sheet. They would all occupy different cells. I already have the following code to transfer form values:

Dim objXLApp As Object
Dim objXLBook As Object
Set objXLApp = CreateObject("Excel.Application")
Set objXLBook = objXLApp.Workbooks.Open(S:\FilePath of XL Sheet I want to export to)

objXLBook.ActiveSheet.Range("AB2") = Me.Control1
objXLBook.ActiveSheet.Range("A3") = Me.Control2
objXLBook.ActiveSheet.Range("A4") = "Project No" & Space(1) & Me.ProjectNo


All 3 subform filters look something like this:

SELECT [tbl_Frac].[PROPPANT], [tbl_Frac].[WATER], [tbl_Frac].[ACID], [Well General Info].[WellIDNo]
FROM [tbl_FracReports], [Well General Info]
WHERE [Well General Info].[WellIDNo] = [tbl_Frac].[WellIDNo]

Someone has to know a way to do this. If I need to post more info let me know!
 
My reply hasn't sent yet? Delete this post if redundant

It's been almost an hour since I replied and i don't see it yet. Not sure if this is normal or not.

If my replies have to go thru mods and they're busy or something then just delete this post.. thx
 
Wtf this is the 3rd time ive tried to respond to david

what is going on

im so mad im going all caps lock in this *****
 

Users who are viewing this thread

Back
Top Bottom