V
Vikki
I have an (exisitng) ADP database. I know that there are things that you can
and cannot do with an ADP, but I don't know what they are. Any suggestions
on where to brush up on that would be appreciated.
I need to create a form where users can update a product promotion category
on several records (product briefs) at a time. They don't want to have to
enter each product brief, add/change/delete the catagories, then move on to
the next product brief and repeat. They want to bring up all product briefs
that meet a date range and update at will--kind of like 'spreadsheet style'.
The "field" they want to update is a many-to-many relation type field called
product promotions. This "field" is actually another table that contains the
key fields for the product brief and the promotion table. There may be
multiiple promotions for a product brief. Also, I have an originator (as
orgntr_rsrc_id) stored in the product brief table. The originator's first
and last name is stored in the resource table with rsrc_id as the key.
I have 2 unbound fields on the form that the user maintains to setup the
date range parameters to filter the records that are returned. They are
txtFromDate and txtToDate.
I have tried to accomplish this 2 different ways, one using the product
brief table as a record source and applying a serverfilter and the other
using a stored procedure as a record source, passing the dates as parameters.
In both cases the product promotions are handled with a subform and that
peice works.
Method 1:
I use the product brief table as the forms record source. The user enters
the begin and end dates and click a "search" button which runs the following
code to apply a serverfilter.
Private Sub Command213_Click()
If IsNull(Me.txtFromDate) Then
fromdate = #1/1/1900#
Else
fromdate = Me.txtFromDate.Value
End If
If IsNull(Me.txtToDate) Then
todate = #1/1/1900#
Else
todate = Me.txtToDate.Value
End If
Me.ServerFilter = "rtl_lnch_dt between '" & CStr(fromdate) & "' and '" _
& CStr(todate) & "' Or smpl_prgms_dt between '" & CStr(fromdate) & "' and '" _
& CStr(todate) & "'"
Me.Refresh
End Sub
This code is ok, and technically accomplishes what the user wants EXCEPT
they want the resource name, rather than Id, to appear. I have tried the
following select in the control source of the Originator text box but I get
#Name returned. Spellings are correct--if I copy this select over to the
server (MS SQL Server Management Studio), remove the parenthesis and change
the &'s to +'s it runs just fine
=(SELECT isnull([dbo].[rsrc_t].[rsrc_first_nm]
&''&[dbo].[rsrc_t].[rsrc_last_nm],' ') From [dbo].[rsrc_t] inner join
[dbo].[prdct_brief_t] on
[dbo].[rsrc_t].[rsrc_id]=[dbo].[prdct_brief_t].[orgntr_rsrc_id])
Maybe I can't do this in an ADP???
Method 2:
The control source for the form is:
exec pd_upd_NPI_p '3/1/2009', '3/31/2009'
where the 2 dates are the parameters for the beginning and ending date
ranges. The stored procedure correctly formats the Originator Name. It
opens with the correct data for the dates hard coded in the record source. I
am able to modify the records as desired. Seems Perfect! Then I change the
dates on the form to 10/01/2008 and 10/31/2008 and click my search button to
perform the following code:
Private Sub cmdRtrvRcrds_Click()
Dim fromdate As Date
Dim todate As Date
If IsNull(Me.txtFromDate) Then
fromdate = #1/1/1900#
Else
fromdate = Me.txtFromDate
End If
If IsNull(Me.txtToDate) Then
todate = #1/1/1900#
Else
todate = Me.txtToDate
End If
Me.RecordSource = "exec pd_upd_NPI_p '" & CStr(fromdate) & "', '" &
CStr(todate) & "'"
This code will then show the correct records for the October date range.
However, when I click on any of the records in the datasheet view, one of two
things will happen. I may get a message on the first click that says "One of
your parameters is invalid" with no error number and OK as the only option. I
click OK and select a different record (or click on the same record again)
and Access will hang-[Not Responding]. I have to alt-ctrl-del to shut it
down.
The other thing that may happen is really the same thing, but I don't get
the parameter message at all--I go immediately to not responding.
I am wondering if the resync command may be the key here. I have no idea
how to use it--I have done some searches, but haven't gotten a warm fuzzy
feeling that I know how to use it. If resync isn't the answer--any other
suggestions would be welcome.
...and yes, it has to stay a "project" because the boss says so.
and cannot do with an ADP, but I don't know what they are. Any suggestions
on where to brush up on that would be appreciated.
I need to create a form where users can update a product promotion category
on several records (product briefs) at a time. They don't want to have to
enter each product brief, add/change/delete the catagories, then move on to
the next product brief and repeat. They want to bring up all product briefs
that meet a date range and update at will--kind of like 'spreadsheet style'.
The "field" they want to update is a many-to-many relation type field called
product promotions. This "field" is actually another table that contains the
key fields for the product brief and the promotion table. There may be
multiiple promotions for a product brief. Also, I have an originator (as
orgntr_rsrc_id) stored in the product brief table. The originator's first
and last name is stored in the resource table with rsrc_id as the key.
I have 2 unbound fields on the form that the user maintains to setup the
date range parameters to filter the records that are returned. They are
txtFromDate and txtToDate.
I have tried to accomplish this 2 different ways, one using the product
brief table as a record source and applying a serverfilter and the other
using a stored procedure as a record source, passing the dates as parameters.
In both cases the product promotions are handled with a subform and that
peice works.
Method 1:
I use the product brief table as the forms record source. The user enters
the begin and end dates and click a "search" button which runs the following
code to apply a serverfilter.
Private Sub Command213_Click()
If IsNull(Me.txtFromDate) Then
fromdate = #1/1/1900#
Else
fromdate = Me.txtFromDate.Value
End If
If IsNull(Me.txtToDate) Then
todate = #1/1/1900#
Else
todate = Me.txtToDate.Value
End If
Me.ServerFilter = "rtl_lnch_dt between '" & CStr(fromdate) & "' and '" _
& CStr(todate) & "' Or smpl_prgms_dt between '" & CStr(fromdate) & "' and '" _
& CStr(todate) & "'"
Me.Refresh
End Sub
This code is ok, and technically accomplishes what the user wants EXCEPT
they want the resource name, rather than Id, to appear. I have tried the
following select in the control source of the Originator text box but I get
#Name returned. Spellings are correct--if I copy this select over to the
server (MS SQL Server Management Studio), remove the parenthesis and change
the &'s to +'s it runs just fine
=(SELECT isnull([dbo].[rsrc_t].[rsrc_first_nm]
&''&[dbo].[rsrc_t].[rsrc_last_nm],' ') From [dbo].[rsrc_t] inner join
[dbo].[prdct_brief_t] on
[dbo].[rsrc_t].[rsrc_id]=[dbo].[prdct_brief_t].[orgntr_rsrc_id])
Maybe I can't do this in an ADP???
Method 2:
The control source for the form is:
exec pd_upd_NPI_p '3/1/2009', '3/31/2009'
where the 2 dates are the parameters for the beginning and ending date
ranges. The stored procedure correctly formats the Originator Name. It
opens with the correct data for the dates hard coded in the record source. I
am able to modify the records as desired. Seems Perfect! Then I change the
dates on the form to 10/01/2008 and 10/31/2008 and click my search button to
perform the following code:
Private Sub cmdRtrvRcrds_Click()
Dim fromdate As Date
Dim todate As Date
If IsNull(Me.txtFromDate) Then
fromdate = #1/1/1900#
Else
fromdate = Me.txtFromDate
End If
If IsNull(Me.txtToDate) Then
todate = #1/1/1900#
Else
todate = Me.txtToDate
End If
Me.RecordSource = "exec pd_upd_NPI_p '" & CStr(fromdate) & "', '" &
CStr(todate) & "'"
This code will then show the correct records for the October date range.
However, when I click on any of the records in the datasheet view, one of two
things will happen. I may get a message on the first click that says "One of
your parameters is invalid" with no error number and OK as the only option. I
click OK and select a different record (or click on the same record again)
and Access will hang-[Not Responding]. I have to alt-ctrl-del to shut it
down.
The other thing that may happen is really the same thing, but I don't get
the parameter message at all--I go immediately to not responding.
I am wondering if the resync command may be the key here. I have no idea
how to use it--I have done some searches, but haven't gotten a warm fuzzy
feeling that I know how to use it. If resync isn't the answer--any other
suggestions would be welcome.
...and yes, it has to stay a "project" because the boss says so.