DAO help 
Author Message
 DAO help

I'm just studying VB, and i have project where I have to create program to
access Aceess97
database.  I'm using VB5 and Access97 and DAO method to assess database.  I
have 4 general
1 main form with tab controls on it, and by clicking tab button certain form
would open.  I
also have search form, where user will look for the particular record, and
all data
associated with this record must be open in all 4 forms. Ex, RefNo 5, and
all data for this
client with RefNo5 must appear in all forms.
Please, can anyone suggest and if possible show how I can use code to search
for a
particular record and then show data associated with this record in all
forms.
Any comments will be appreciated.
Thanks in advance
Vlad


Mon, 10 May 2004 12:54:20 GMT  
 DAO help
Vladimir, here's a couple of sub's that should help you
to get started. Don't forget to add the DAO references.
You can use an SQL Query to search for a particular field
based on the criteria you give it. If you want this information
accessible to all forms within the project, then look to changing
the following code (Add it to a Standard Module (.BAS)) file
as public.

Good Luck.
Chris Val
========

Option Explicit
Dim RecCounter As Long
Dim db As DAO.Database, rst As Recordset
'-----------------------------------------------------------------------------------

Private Sub ExecuteQuery()
   '
   Set db = OpenDatabase("PathToYourDatabase.mdb")
   Set rst = db.OpenRecordset("SELECT * FROM YourTable WHERE FieldName = 'Something'")
     '
     Do While Not rst.EOF
     '
     ' Add a combo box box to test it out...
     Combo1.AddItem IIf(IsNull(rst!FieldName), "", rst!FieldName)
     '
     rst.MoveNext
     '
     Loop
     '
End Sub

'-----------------------------------------------------------------------------------

Private Sub WriteToDatabase()
 '
 Set db = OpenDatabase("PathToYourDatabase.mdb", , False)
 '
 db.Execute "INSERT INTO YourTable (FieldName) VALUES ('NewData')"
 '
End Sub
'-----------------------------------------------------------------------------------


| I'm just studying VB, and i have project where I have to create program to
| access Aceess97
| database.  I'm using VB5 and Access97 and DAO method to assess database.  I
| have 4 general
| 1 main form with tab controls on it, and by clicking tab button certain form
| would open.  I
| also have search form, where user will look for the particular record, and
| all data
| associated with this record must be open in all 4 forms. Ex, RefNo 5, and
| all data for this
| client with RefNo5 must appear in all forms.
| Please, can anyone suggest and if possible show how I can use code to search
| for a
| particular record and then show data associated with this record in all
| forms.
| Any comments will be appreciated.
| Thanks in advance
| Vlad
|
|



Tue, 11 May 2004 21:30:31 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. DAO Help required

2. Can't get DAO help

3. Need DAO help

4. DAO help here

5. I need some DAO help urgently

6. Recordset problem DAO - HELP!

7. ADO, DAO help files missing

8. DAO HELP NEEDED

9. DAO help

10. ODBC through DAO help needed

11. SQL problem with DAO...help

12. DAO - Help For A Newbie

 

 
Powered by phpBB® Forum Software