Results 1 to 5 of 5

Thread: Passin a parameter - PROBLEM !!!!!

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    South-Africa
    Posts
    46

    Post

    Why do i get a "type mismatch error" when i pass a "string" as a parameter.
    Here is my code:
    _____________________________________________

    Private Sub cmdReport_Click()

    'The If block closes the recordset if it was previously open before
    'running the parameterized query.
    With DataEnvironment1
    If .rsContacts.State = adStateOpen Then
    .rsContacts.Close
    End If
    ' This passes in the value entered into the TextBox.
    .Contacts txtCust.Text ' My Parameter

    ' This If block checks to determine if any records are returned
    ' by the parameter. Then it shows a report if records are returned.
    ' Or displays a Message Box if no records are returned.

    If .rsContacts.RecordCount > 0 Then
    ' Degbug shows a number of records in the data source
    Set rptContact.DataSource = DataEnvironment1

    rptContact.Show
    Else
    MsgBox "No Titles found" & txtCust.Text
    End If
    End With
    End Sub
    _____________________________________________

    If my string is a value it works ok.I have also tried changing my parameters datatypes at the property pages.NO success.I hope i did it right.

    Can anybody help me please?

    Thanks.


  2. #2

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    South-Africa
    Posts
    46

    Post

    No success yet can somebody please help.
    Thanks.

  3. #3
    Hyperactive Member
    Join Date
    Feb 2000
    Posts
    284

    Post

    Just incase you overlooked it -
    Are you sure your string is enclosed with apostrophes eg -

    myString = "'" & txtCust.text & "'"

    DataEnvironment1.contacts myString

  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    South-Africa
    Posts
    46

    Post

    To Bigley tried it.
    No success.
    How must my data type (host data type) look at my properties tab in my command at my dataenvironment.Remember i gave my parameter as a "?".

    Thanks.

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    South-Africa
    Posts
    46

    Post

    No success yet.
    P L E A S E H E L P !!!!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width