R
Rob
Hi ….I have this Code that connects to our AS/400 to capture data using
hidden forms with users input. It works well but I need to enhance it a
little bit.
Current process: User has to select individual month to download their data
(one month at a time). Very tedious process especially when you’re
downloading 18 months worth of data.
Preferred process: What I want to do is to replace the strFRM string ("FROM
" & strFRM & " (see code below)) line to look at my
tblTABLE_NAMES.TABLE_NAME1 where Selected=YES , so the users can download and
process multiple months in one shot.
tblTABLE_NAMES fields (TBL_NO, TABLE_NAME1, Selected)
I want it to do a loop until all Selected=YES are processed. Can any of you
experts help me out?? Sorry, I’m a newbie to VBA ïŒ, so any help is very much
appreciated!
As always, you guys are wonderful !
Thanks,
Rob
Dim db As Database
Dim qdf As QueryDef
Dim strSQL As String
Dim strFRM As String
strFRM = Me.cboF10.Value
strFRM2 = Forms!FRMTABLENAMES.cboTableName2.Value
strFRM3 = Forms!FRMTABLENAMES.cboTableName3.Value
Set db = CurrentDb
Set qdf = db.QueryDefs("001-qextract_query")
Debug.Print "Default ODBCTimeout of QueryDef: " & _
qdf.ODBCTimeout
qdf.ODBCTimeout = 100
DoCmd.SetWarnings False
DoCmd.OpenForm "frmtablenames", , , , , acHidden
DoCmd.OpenForm "frmProcessing"
DoCmd.RepaintObject acForm, "frmprocessing"
DoCmd.Echo False, "Downloading data...."
strSQL = "INSERT INTO TEMPMAINDATA_OD_Temp ( …….. )" & _
"SELECT ………. " & _
"FROM " & strFRM & " " & _
"where ………"
qdf.SQL = strSQL
DoCmd.OpenQuery "001-qextract_query"
MsgBox "Appended " & strFRM & " to the Table", vbOKOnly
DoCmd.OpenQuery "qAppend_tempmaindata_od_temp"
DoCmd.Close acForm, "frmprocessing"
DoCmd.Echo True
End Sub
hidden forms with users input. It works well but I need to enhance it a
little bit.
Current process: User has to select individual month to download their data
(one month at a time). Very tedious process especially when you’re
downloading 18 months worth of data.
Preferred process: What I want to do is to replace the strFRM string ("FROM
" & strFRM & " (see code below)) line to look at my
tblTABLE_NAMES.TABLE_NAME1 where Selected=YES , so the users can download and
process multiple months in one shot.
tblTABLE_NAMES fields (TBL_NO, TABLE_NAME1, Selected)
I want it to do a loop until all Selected=YES are processed. Can any of you
experts help me out?? Sorry, I’m a newbie to VBA ïŒ, so any help is very much
appreciated!
As always, you guys are wonderful !
Thanks,
Rob
Dim db As Database
Dim qdf As QueryDef
Dim strSQL As String
Dim strFRM As String
strFRM = Me.cboF10.Value
strFRM2 = Forms!FRMTABLENAMES.cboTableName2.Value
strFRM3 = Forms!FRMTABLENAMES.cboTableName3.Value
Set db = CurrentDb
Set qdf = db.QueryDefs("001-qextract_query")
Debug.Print "Default ODBCTimeout of QueryDef: " & _
qdf.ODBCTimeout
qdf.ODBCTimeout = 100
DoCmd.SetWarnings False
DoCmd.OpenForm "frmtablenames", , , , , acHidden
DoCmd.OpenForm "frmProcessing"
DoCmd.RepaintObject acForm, "frmprocessing"
DoCmd.Echo False, "Downloading data...."
strSQL = "INSERT INTO TEMPMAINDATA_OD_Temp ( …….. )" & _
"SELECT ………. " & _
"FROM " & strFRM & " " & _
"where ………"
qdf.SQL = strSQL
DoCmd.OpenQuery "001-qextract_query"
MsgBox "Appended " & strFRM & " to the Table", vbOKOnly
DoCmd.OpenQuery "qAppend_tempmaindata_od_temp"
DoCmd.Close acForm, "frmprocessing"
DoCmd.Echo True
End Sub