Results 1 to 3 of 3

Thread: help on how to add new records.....

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Location
    singapore
    Posts
    4

    Post

    hi,

    I have this problem on the program I am writing, the code is as follow:

    Private Sub adoClients_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

    Dim strQuery As String

    strQuery = "select Service, ServiceDate from tblServices where clientID = " & adoClients.Recordset!ClientID
    adoServices.CommandType = adCmdText
    adoServices.RecordSource = strQuery
    adoServices.Refresh
    End Sub
    --------------------------------------------
    Private Sub mnuAdd_Click()

    adoServices.Recordset.AddNew
    adoClients.Recordset.AddNew


    End Sub

    --------------------------------------------

    when i run the program and try to add a new records, it will give me a syntax error on ClientID ="". How can i bypass this problem?

    thanks in advance


  2. #2
    Lively Member
    Join Date
    Aug 1999
    Location
    Blackpool, England
    Posts
    87

    Post

    Depends on the data type of Client ID
    try this
    strQuery = "select Service, ServiceDate from tblServices where clientID = '" & adoClients.Recordset!ClientID & "'"

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Location
    singapore
    Posts
    4

    Post


    Depends on the data type of Client ID
    try this
    strQuery = "select Service, ServiceDate from tblServices where clientID = '" & adoClients.Recordset!ClientID & "'"

    Thanks for helping!
    ClientID is a long Datatype and it still give me the error message after i input in the "", when i debug it, it give me a null field in the query.

    how to bypass this error?

    Thanks in advance

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