G
Guest
Greetings all. Form1 has 3 combos - cboRegion, cboECD1, and cboECD2, all are
unbound. I want them to pass their values to a procedure used as the record
source of Form2. I have recently honed this set up thanks to Sylvain and
Robert, but it will not work this time. The procedure is as follows.
ALTER procedure spODNSchedule
@region varchar(50), @ecd1 char(15), @ecd2 char(15)
As
Declare @SQLString varchar(1000)
Declare @SelectList varchar(1000)
SET NOCOUNT ON
SELECT @SelectList = 'select * from vODNSchedule'
IF @region IS NOT NULL
BEGIN
SELECT @SQLString = 'where region = ''' + @region + '''and ecd '
END
ELSE
BEGIN
SELECT @sqlstring = 'where ecd '
END
IF @ecd1 IS NOT NULL
BEGIN
IF @ecd2 is not null
BEGIN
SELECT @SQLSTRING = @SQLSTRING + 'between ''' + @ecd1 + '''and ''' +
@ecd2 +''''
END
ELSE
IF @ecd2 is null
BEGIN
SELECT @SQLSTRING = @SQLSTRING + '= ''' + @ecd1 + ''''
END
END
IF @SQLSTRING IS NOT NULL
BEGIN
SELECT @SQLSTRING = @SQLSTRING + 'order by region, co, rte, ewo'
END
SELECT @SelectList = @SelectList + ' ' + @SQLString
EXECUTE(@SELECTLIST)
when I run the procedure from query analyzer it works fine, and when I run
it from the database window of my ADP(2000) it runs fine. When I try to open
form2 from a command button on form1 it opens, and down at the bottom I can
see the number of records, but no records are displayed. The input
parameters of form2 are @region=forms!form1!cboRegion, and the same form
ecd1&2. I do not know what else to try. What I want is for @region to be
optional, and @ecd2 to be optional. The pupose of the procedure is to
produce a schedule. If no region is chosen the schedule should reflect the
whole state. If no ecd2 is chosen the schedule will only be for one month,
otherwise it will be for a date range. Thanks for any help.
unbound. I want them to pass their values to a procedure used as the record
source of Form2. I have recently honed this set up thanks to Sylvain and
Robert, but it will not work this time. The procedure is as follows.
ALTER procedure spODNSchedule
@region varchar(50), @ecd1 char(15), @ecd2 char(15)
As
Declare @SQLString varchar(1000)
Declare @SelectList varchar(1000)
SET NOCOUNT ON
SELECT @SelectList = 'select * from vODNSchedule'
IF @region IS NOT NULL
BEGIN
SELECT @SQLString = 'where region = ''' + @region + '''and ecd '
END
ELSE
BEGIN
SELECT @sqlstring = 'where ecd '
END
IF @ecd1 IS NOT NULL
BEGIN
IF @ecd2 is not null
BEGIN
SELECT @SQLSTRING = @SQLSTRING + 'between ''' + @ecd1 + '''and ''' +
@ecd2 +''''
END
ELSE
IF @ecd2 is null
BEGIN
SELECT @SQLSTRING = @SQLSTRING + '= ''' + @ecd1 + ''''
END
END
IF @SQLSTRING IS NOT NULL
BEGIN
SELECT @SQLSTRING = @SQLSTRING + 'order by region, co, rte, ewo'
END
SELECT @SelectList = @SelectList + ' ' + @SQLString
EXECUTE(@SELECTLIST)
when I run the procedure from query analyzer it works fine, and when I run
it from the database window of my ADP(2000) it runs fine. When I try to open
form2 from a command button on form1 it opens, and down at the bottom I can
see the number of records, but no records are displayed. The input
parameters of form2 are @region=forms!form1!cboRegion, and the same form
ecd1&2. I do not know what else to try. What I want is for @region to be
optional, and @ecd2 to be optional. The pupose of the procedure is to
produce a schedule. If no region is chosen the schedule should reflect the
whole state. If no ecd2 is chosen the schedule will only be for one month,
otherwise it will be for a date range. Thanks for any help.