Referring Form Control in Access Project View

A

Agus Budianto

Dear All,

I am new to Access Project.
I am trying to move my access database application to access project
connected to SQL Server.

I am rewriting my old query into Access Project View.
Each time I refer a form control in the criteria column of a view, it is
interpreted as a text.

Anybody can help?

Rgds,
Agus Budianto
 
A

Alex White MCDBA MCSE

Hi,

Personally I use stored procedures rather than views when converting
queries, and what works for me is using parameters within the stored
procedure. If you have a textbox on your form call First_Name and a
parameter in your stored procedure called @First_Name the value from the
form gets evaluated when the stored procedure is run. Think of stored
procedures in the same way as views, they can be called in the same way and
can produce the same results with a bit flexibility.

Hope it helps.
 
A

Agus Budianto

Dear Alex,

Thanks for the reply.

The Next Questions are:
How to attach the stored procedure to a list box.
And How to past the value of the control to the stored procedure

Sorry to bother you with the questions

Rgds,
Agus Budianto
 
A

Alex White MCDBA MCSE

Hi,

If your listbox is called

lstMyWork

then lstMyWork.RowSource = 'Sp_List_Letters'

now I have cut and paste a little stored procedure, you will see there is a
parameter called Candidate_ID, I have not passed the parameter because the
calling form has a textbox on it called Candidate_ID, so you don't need in
this example to pass anything on the command line.

Alter Procedure Sp_List_Letters
(
@Candidate_ID numeric
)
As
Select Candidate_Contact_History_ID, Date, Consultant_Initials as 'CI',
Stage, FileName as 'File Name', Description, Notes from
TblCandidate_Contact_History where Candidate_ID=@Candidate_ID order by Date
DESC
return
here is another example
of calling a stored procedure being used to return an ADO recordset

..Open "Sp_Display_Religion_Rules " & Me.Religion_ID.Value,
CurrentProject.Connection, adLockReadOnly

In the above example I am opening a recordset and passing a value to the
stored procedure.

CurrentProject.Connection.Execute "Sp_Religion_SelectShift " &
Me.Religion_ID.Value & ", 'Early'"

In this example I am setting 2 parameters and just executing the stored
procedure

I hope the above helps, if you need any more help post back here.
 
A

Agus Budianto

Thanks Alex.
The problem is solved.

See you in the next issue.

Again, Thank you!

Agus Budianto
 
Top