DAO COM Question.

Started by Anonymous, August 22, 2004, 11:38:43 PM

Previous topic - Next topic

Anonymous

Paul,

I finally got around over holidays to have a good look at Firefly WoW! I am very impressed so far.

Any ways I am in the process for the third time learing curve you know of building a front end for a Microsoft access database using DAO 3.6. I know, I know who uses DAO I do becasue I cut my teeth on it and, have the best understanding of it.

Finally here comes the question. After I add the Com/Ocx control to the form and select the Program ID how do I interface to the control. Using SDK I would do something like the following.

               vField1 = 0
       vField2 = 1
     vField3 = 2                    
       vField4 = 3    
                         
    SET oDAOAPP = NEW DAODBEngine IN "DAO.DBEngine.36"

    vSQL = "LaborRate.MDB"
    OBJECT CALL oDAOApp.OpenDataBase(vSQL) TO nVNT

    SET oDAODatabase = nVNT
    vSQL = "Select * from Labour"

    OBJECT CALL oDAODatabase.Openrecordset(vSQL) TO nVNT
    SET oDAORecord  = nVNT
    OBJECT GET oDAORecord.Eof TO nVNT


    IF ISFALSE VARIANT#(nVNT) THEN
       Object Call oDAORecord.Movefirst
       OBJECT GET oDAORecord.Fields.Item(vField1).Value TO vItem0
       Object Get oDAORecord.Fields.Item(vField2).Value To vItem1
       OBJECT GET oDAORecord.Fields.Item(vField3).Value TO vItem2
       OBJECT GET oDAORecord.Fields.Item(vField4).Value TO vItem3
       END IF
   
   a$ = Variant$(vItem0)
   b$ = Variant$(vItem1)
   c$ = Variant$(vItem2)
   d$ = Variant$(vItem3)
     
   Sendmessage hTxt1,%WM_SETTEXT,0,StrPtr(a$)
   Sendmessage hTxt2,%WM_SETTEXT,0,StrPtr(b$)
   Sendmessage hTxt3,%WM_SETTEXT,0,StrPtr(c$)
   Sendmessage hTxt4,%WM_SETTEXT,0,StrPtr(d$)

After I include the DAO inc file and set up the variables.

Can you or someone else provide a example that I can learn from?
I seen a reference to a tutorial 2 but can not find it on your web site.

Thanks

Blair

Jose Roca

DAO is not a visual OCX, so you do not have to include it in the form as if it where a control. This is not Visual Basic.  Just use it as you're showing in your code.

TechSupport

Thanks Jose, I had previously replied to Blair via private email with a similar response as yours. I also suggested that he look at ADO instead of DAO.