Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data from Form passed to Stored Procedure

Status
Not open for further replies.

BB69

MIS
Jun 23, 2003
37
US
Hello,

I am in the process of converting an Access 2000 Database to an Access 2000 Project with an SQL server 2000 backend. I am having a problem passing information I selected from my combo box to the stored procedure. I verified the procedure works because I get the information I entered in the popup box on the next form. I have included the portion of the form and the Stored procedure.

I am relatively new to database programming so any help would be appreciated.



Click on Form Button Code

Private Sub Command143_Click()

Dim strlink As String
Me.BOM.SetFocus
Me.Command143.Visible = False
Me.Combo142.Visible = False

If Not IsNull(Me.Combo142) Then
strlink = "[Type de système]= Forms![Main]![Combo142]"
End If

DoCmd.OpenForm "FCustomer", acNormal
', , strlink
Forms![FCustomer]![LABEL].Caption = Forms![Main]![Combo142]
End Sub


Stored Procedure Code

Alter Procedure "QCustomer"

(
@Types NVarchar(50)
)
As
SELECT [Type de système], [Numéro de système], NomSociete,
Adresse, CodePostal, Ville, Country, TelProfessionnel,
Departement, [Instructor desk phone], NumTelecopie, Email,
NomContact, Remarques, Lanes, Software
FROM dbo.TCustomer
WHERE [Type de système] = @Types
return

 
Hello,

I forgot to add I need to pass what is stored in Combo142 to Types in the stored procedure
 
I have tried using the old query but I get an error, ADO error, incorrect syntax near !, with pointing to the form

I have no idea what is wrong so anybody please help me. The code for the original query is below.


SELECT TCustomer.[Type de système], TCustomer.[Numéro de système], TCustomer.NomSociete, TCustomer.Adresse, TCustomer.CodePostal, TCustomer.Ville, TCustomer.Country, TCustomer.TelProfessionnel, TCustomer.Departement, TCustomer.[Instructor desk phone], TCustomer.NumTelecopie, TCustomer.Email, TCustomer.NomContact, TCustomer.Remarques, TCustomer.Lanes, TCustomer.Software
FROM TCustomer
WHERE (((TCustomer.[Type de système])=[Forms]![Main]![Combo142]));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top