Results 1 to 3 of 3

Thread: Newbie simple select statement

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    Home
    Posts
    85

    Newbie simple select statement

    Hi People

    Having a small problem with a select statement which I cant get my head around.Could someone show me the correct syntax Please?

    I need to show records only for a particular Vacancy ID id so this is what i am attempting. this works if i remove the where statement,

    Dim db As Connection
    Set db = New Connection
    db.CursorLocation = adUseClient
    db.Open "PROVIDER=MSDASQL;dsn=XPHOME;uid=Paul ;pwd=;database=ContractManagement;"

    set Contacts as new Recordset
    contacts.open " select lngVacancyID, lngContractorID,chrContractorName,chrContractorState,chrComments,chrInterviewDetails, blnSubmitted, blnSuccessful from tblsubmittedcontractors WHERE lngVacancyID = " & me.txtfields(0).text, db, adOpenStatic, adLockOptimistic


    dgContacts.datasource = Contacts
    dgContacts.refresh

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    Your syntax is correct.

    Make sure txtFields(0).Text contains a valid lngVacancyId. Based on the naming convention, I am assuming that lngVacancyId is a numeric field and not a number stored in a character field. If that is not the case surround the value with single quotes.
    Last edited by brucevde; Jun 4th, 2004 at 07:18 PM.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    Home
    Posts
    85
    Hi There
    Thanks for the reply, I worked it out, I hadnt bound the text boxes to the datasource before attempting to bind the datagrid

    Thanks for making me look!!

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