PDA

Click to See Complete Forum and Search --> : help on how to add new records.....


learn_to_program
Feb 22nd, 2000, 03:31 PM
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

SteveFlitIII
Feb 22nd, 2000, 07:32 PM
Depends on the data type of Client ID
try this
strQuery = "select Service, ServiceDate from tblServices where clientID = '" & adoClients.Recordset!ClientID & "'"

learn_to_program
Feb 23rd, 2000, 02:00 PM
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