-----Original Message-----
Hi Faddrick,
1) If you're using Visual Basic or Excel VBA (as opposed to Access VBA)
to work with data in an mdb file,
a) build a SQL SELECT statement incorporating the user's conditions
b) open a recordset on this
c) use Excel's Range.CopyFromRecordset method to put the data into
your worksheet.
If you're using Access VBA, you could do the same, or else (with less
flexibility and some security issues in Access 2003):
a) build the SELECT statement
b) assign it to the SQL property of a query (QueryDef)
c) use the query with DoCmd.TransferSpreadsheet to export the data.
2) Assuming you're using Visual Basic: if you want the names of the
fields, use something along the lines of this air code. If you want to
display the data, study the VB help on recordsets, data controls and (I
think) the DataGrid control. If you still can't get started, ask in a
Visual Basic group rather than an Access one.
Dim odbE As DAO.DBEngine
Dim odbD As DAO.Database
Dim F as DAO.Field
Set odbE = New DAO.DBEngine
Set odbD = dbE.OpenDatabase("D:\folder\file.mdb")
For Each F in odbD.QueryDefs("MyQuery").Fields
Debug.Print F.Name
'put them into a listbox perhaps
Next
odbD.Close
Set odbD = Nothing
Set odbE = Nothing
Hello,
I have the following doubts ,
1) how do i transfer the data's from Access to Excel based
on users condition using Vb as front end?
2) How do i display the fields to the end user from a ms
access query in vb ?
plzz reply me asap.
Faddrick
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
.