ad____ and .execute 
Author Message
 ad____ and .execute

This is an example of the project that I am trying to
create but it keeps giving me error...

adOpenKeyset, adLockPessimistic of the codes below cannot
work....

ERROR MSG: An error was encountered while running this
program: Variable is undefined: "adOpenForwardOnly"

       'Rs.Open "select CID from & _
       '& "gcstr_TBL_Company_Information & " where " & _
       '& gcstr_Fld_CID & "='" & Trim(txtCID) & "' , & _
       'Conn, adOpenKeyset, adLockPessimistic"

        Rs.Open "Company_Information"Conn, & _
        adOpenKeyset, adLockPessimistic"

I tried bothe the codings but it give me the same error
I'm not sure where went wrong.

also both the codes ".execute" also have error
Conn.Execute InsertQuery
' rs = Conn.Execute(InsertQuery)

Please Help!!! I need the solution to solve my project.
Thanks in advance.

---------------EXAMPLE------------------------------------

Private Sub cmdAdd_Click()
'On Error Resume Next

Dim Rs As ADOCE.Recordset
Dim Cn As ADOCE.Connection
Dim strSQL As String
Dim strFieldNames As String
Dim strFieldValues As String
Dim InsertQuery As String

Set Cn = CreateObject("ADOCE.Connection.3.1")
Set Rs = CreateObject("ADOCE.Recordset.3.1")

    If validate Then Exit Sub

       'Rs.Open "select CID from & _
       '& "gcstr_TBL_Company_Information & " where " & _
       '& gcstr_Fld_CID & "='" & Trim(txtCID) & "' , & _
       'Conn, adOpenKeyset, adLockPessimistic"

        Rs.Open "Company_Information"Conn, & _
        adOpenKeyset, adLockPessimistic"

    If MsgBox("Do you want to save record ?", vbYesNo & _
     +  vbInformation) = vbYes Then

      strFieldNames = strFieldNames & gcstr_Fld_CID & ","
      strFieldNames = strFieldNames & gcstr_Fld_CName & ","

      If Len(Trim(txtCID.Text)) = 0 Then
         strFieldValues = strFieldValues & "''" & ","
      Else
         strFieldValues = "'" & strFieldValues & CStr & _
               (txtCID.Text) & "','"
      End If

      If Len(Trim(txtCName.Text)) = 0 Then
          strFieldValues = strFieldValues & "''" & ","
      Else
          strFieldValues = strFieldValues & CStr & _
           (txtCName.Text) & "','"
      End If

      InsertQuery = InsertQuery & "INSERT INTO " & _
      &  gcstr_TBL_Company_Information & _
      " (" & strFieldNames & ")" & _
      " VALUES" & _
      " (" & strFieldValues & ")"

      Conn.Execute InsertQuery
      ' rs = Conn.Execute(InsertQuery)

      Conn.Close
      Set Conn = Nothing

   End If

 Exit Sub
'errhand:
'If Err Then
'       MsgBox "Please inform the ISD regarding this
error " & Chr(13) & Chr(9) & Err.Number & " " &
Err.IDescription, vbExclamation, "Error in Lipid System"
'        Err.Clear
'End If

End Sub



Sun, 17 Apr 2005 11:08:05 GMT  
 ad____ and .execute
Hi Keld Laursen,

I noe adOpenKeyset, adLockPessimistic, adOpenForwardOnly
etc are the default given by the Visual Basic program
itself that's why I'm puzzled y it cannot work...

Quote:
>> ERROR MSG: An error was encountered while running this
>> program: Variable is undefined: "adOpenKeyset"

Any other suggestion? Maybe I didn't install something?

Need Help urgently!!!

elle



Sun, 17 Apr 2005 16:01:44 GMT  
 ad____ and .execute
Hi elle,
sounds to me like you might not have referenced ADOCE (in PROJECT |
REFERENCES).
have you?

cheers

--

wolf kumpitsch
snr design engineer, thingo ltd

http://www.thingo.co.nz

------------------------- we make things, useful -------------------------


Quote:
> Hi Keld Laursen,

> I noe adOpenKeyset, adLockPessimistic, adOpenForwardOnly
> etc are the default given by the visual basic program
> itself that's why I'm puzzled y it cannot work...

> >> ERROR MSG: An error was encountered while running this
> >> program: Variable is undefined: "adOpenKeyset"

> Any other suggestion? Maybe I didn't install something?

> Need Help urgently!!!

> elle



Sat, 23 Apr 2005 03:18:47 GMT  
 ad____ and .execute
Hi wolf,
I've added the reference...does handheld PC support the
adwhatever? My friends told me that handheld and pi=ocket
PC support different stuff and works differently...how
different?


Wed, 27 Apr 2005 10:03:40 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. qdf.Execute vs. db.Execute

2. ADO: cmd.Execute vs cn.Execute

3. _ conn.execute or cmd.execute?

4. command.execute didn't get executed sometimes

5. command.execute vs. connection.execute

6. _ conn.execute or cmd.execute?

7. Waiting for an application to finish executing before executing next app

8. The next Grey Poupon ad (was: The next Infiniti ad?)

9. display ad hoc query results

10. Ad own reminders for contakts

11. Getting full name out of AD

12. Connect to FTP with Macro ad upload a doc (Help)

 

 
Powered by phpBB® Forum Software