|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
||||
|
||||
|
VBA Access. How do I open a database?
I know this is a stupid question, but the help in Access seems less that helpful. I seem to be following link after link and going round in ever decreasing circles. I'm afraid any second I'm going to disappear up my own .......
It would have been nice if the HELP in Access had an index or contents rather that just a search. How do I know what to search for? I don't know the terminology ![]() I can't find any examples that work to help me. I have the simplest of databases..... It contains just ONE table, 20 columns and 7000 rows. The data is already in the order I want it. I want to be able to run through the data a row at a time and then output it to a html file (nicely formatted in a table), but split it and start another html file when certain fields change. I am getting stuck just accessing the data. Can someone please explain how I can open the table and read a field into a variable, and ideally how to step to the next record. Once I know that, I can manage the rest. (honestly )If you do me a little example could you use the names below, so that I don't get too confused. Thanks. Database is called "parts" Table is called "unpriced" Two columns called "partno" and "description" |
|
#2
|
|||
|
|||
|
From within Access 2000: click Help, Microsoft Access Help, and then click the contents tab to see the help table of contents.
You can simply open the table from the database window, then choose File - Export and select HTML as the export type. There is the opportunity to apply a HTML template. You can use an Access query to use only part of the table or some of the columns. With a query results pane open you can use the File - Export menu to send it to HTML. |
|
#3
|
||||
|
||||
|
Thanks. I had that stupid office assistant keep coming up. I got shot of him now I can see a contents page.
I'm not sure exporting as HTML will be any use to me. I needed to create a "title" page with some drop down boxes that directed the viewer to one of several hundred HTML pages. I wanted to do that automatically. Anyway now I can see the help properly I might be able to find what I want. Thanks again. |
|
#4
|
||||
|
||||
|
I found an ADO tutorial on another forum and it seems to tell me everything I need to know for my project.
I am getting an error though The following code does nothing but write a column from the database to a text file a row at a time. I was just trying that to see if it worked. I get the error "Invalid use of NULL" on the line strMake = MyRecSet("Make") What have I done wrong? The path to the database is correct, the name of the table is correct and the name of the column is correct. Thanks Dim MyConn As ADODB.Connection Dim MyRecSet As ADODB.Recordset Dim strMake As String Private Sub Form_Load() Set MyConn = New ADODB.Connection MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Parts data\evparts.mdb;" MyConn.open Set MyRecSet = MyConn.Execute("SELECT * FROM parts") Open "c:\testlist.txt" For Output As #1 Do Until MyRecSet.EOF strMake = MyRecSet("Make") Print #1, strMake MyRecSet.MoveNext Loop Close #1 MyConn.Close End Sub |
|
#5
|
|||
|
|||
|
Probably you have a record that doesn't have any value for MyRecSet("Make")
Try doing some tests on strMake, like If IsNull(strMake) then strMake = "" |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > VBA Access. How do I open a database? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|