L
Lungta
I'm using Kallal word merge, and he graciously showed the other day how to
specify different directories for different merge letters. That works great
now in the example database I was using to test.
But when I try to migrate it over into my real db backup I'm missing
something. I changed the query name, and am also now trying to call it from
a form/subform setup.
Main form: frmCase1
sf name: sfAppt (continuous form view, user clicks on desired record to make
it Current)
qry used: qryNotifLetters
Option Compare Database
Option Explicit
Dim strSQL As String
Dim strDir As String
Dim strDirPath As String
Dim qryNotifLetters As String
Private Sub cmdMergeAll_Click()
strSQL = "select * from qryNotifLetters WHERE ApptID =" & [txtApptID]
Me.Refresh
MergeAllWord ("select * from qryNotifLetters WHERE ApptID =" &
[txtApptID]), ("word\Caseworker\")
'Note that you could use a condtion in the above sql
End Sub
(1) when this runs it gives error msg:
"no data was created for this merge
make sure the sql is correct
sql was
select * from qryNotifLetters WHERE ApptID =5"
But this is exactly the ApptID I want - why does it not like this sql?
debug.print strSQL gives the same sql
typing ?ApptID=5 in the Immediate window gives "False" (with frmCase1/sfAppt
open to ApptID 5)
I added an unbound txtbox to frmCase1 to reference the txtApptID in case,
but same results.
I searched this newsgroup and it looks like I should reference like this:
WHERE ApptID =" & [Forms]![frmCase1]![sfAppt].[form]![txtApptID]
but that gives the same error msg.
(2) I'm going in circles a bit so could someone please enlighten me as to
which of these Dim statements (above) I really need and which ones I can
delete?
(3) Do I need to specify the strSQL in each sub or do I just set a criteria
for the ApptID field in the qryNotifLetters so that
ApptID=Forms!frmCase1!sfAppt![txtApptID] ?
What I really want is to put the cmd button for cmdMergeAll on the main form
frmCase1 but I would be ok with putting it on each record of the sfAppt if
necessary - just desperately need to get these letters useable.
Any pointers would be most appreciated. Thanks in advance for your time.
specify different directories for different merge letters. That works great
now in the example database I was using to test.
But when I try to migrate it over into my real db backup I'm missing
something. I changed the query name, and am also now trying to call it from
a form/subform setup.
Main form: frmCase1
sf name: sfAppt (continuous form view, user clicks on desired record to make
it Current)
qry used: qryNotifLetters
Option Compare Database
Option Explicit
Dim strSQL As String
Dim strDir As String
Dim strDirPath As String
Dim qryNotifLetters As String
Private Sub cmdMergeAll_Click()
strSQL = "select * from qryNotifLetters WHERE ApptID =" & [txtApptID]
Me.Refresh
MergeAllWord ("select * from qryNotifLetters WHERE ApptID =" &
[txtApptID]), ("word\Caseworker\")
'Note that you could use a condtion in the above sql
End Sub
(1) when this runs it gives error msg:
"no data was created for this merge
make sure the sql is correct
sql was
select * from qryNotifLetters WHERE ApptID =5"
But this is exactly the ApptID I want - why does it not like this sql?
debug.print strSQL gives the same sql
typing ?ApptID=5 in the Immediate window gives "False" (with frmCase1/sfAppt
open to ApptID 5)
I added an unbound txtbox to frmCase1 to reference the txtApptID in case,
but same results.
I searched this newsgroup and it looks like I should reference like this:
WHERE ApptID =" & [Forms]![frmCase1]![sfAppt].[form]![txtApptID]
but that gives the same error msg.
(2) I'm going in circles a bit so could someone please enlighten me as to
which of these Dim statements (above) I really need and which ones I can
delete?
(3) Do I need to specify the strSQL in each sub or do I just set a criteria
for the ApptID field in the qryNotifLetters so that
ApptID=Forms!frmCase1!sfAppt![txtApptID] ?
What I really want is to put the cmd button for cmdMergeAll on the main form
frmCase1 but I would be ok with putting it on each record of the sfAppt if
necessary - just desperately need to get these letters useable.
Any pointers would be most appreciated. Thanks in advance for your time.