How do you create a DataTable (with columns but no records) from an Access Database Table?

I'm fairly new to VB and Access. Let's say I have a Microsoft Access table [Employees] and it is populated with several records. How do I create a DataTable that has all the fields (e.g. LastName, FirstName, SSN, DOH, etc.) but --ZERO-- records?

I googled and found something about a "FMTONLY" but I'm not sure how it works. What's a practical solution? Thanks in advance.


@ rot_natalicw - I think that's a solution for SQL Server. It doesn't work on VB.Net and Microsoft Access. At least, I don't know how to make it work with Oledb Commands.

@ Areesha Ahmed - I want to create an empty --DataSet--, not another empty --Database Table--. By "DataSet", I'm referring to the ADO object in VB.

3 Answers

  • 7 years ago
    Favorite Answer

    Open MS Access, Create a blank database. After Creating the database, on the right side of the window, a sheet appear with rows and columns. right click on it, then click on Design view. Now Three columns appear. 1st is Field, 2nd will be type of data, and 3rd will be Description. Write the entities of Employee under Field column, Define Data type , give some description and save it.In the left panel, click on newly created table, It will be a Data Table without Record.

    • Commenter avatarLogin to reply the answers
  • 3 years ago

    the middle of the bill is there. newborn screening is extreme for early detection and long term viability of youngsters born with inborn blunders in metabolism and different detectable genetic illnesses. So increasing this technique is particularly lots a solid component. even although, i might accept as true with Dr. Paul in that any info obtained from application must be gathered anonymously and that the privateness rights and affected person information of any baby that comes up beneficial for a genetic ailment must be secure and could by no ability be released w/o the parent's consent. solid question. the undertaking comes into play in that refusing the toddler screening is corresponding to refusing lifesaving scientific look after your baby. in the journey that your baby occurs to have a metabolic ailment that would desire to be picked up with a $5 genetic try which you refuse, your baby would desire to go through irreparable recommendations harm from that ailment or finally ends up loss of existence. and since the baby will no longer be able to settle for or deny scientific care of its very own accord the state steps in. because of the fact of this i've got self assurance you will no longer be able to refuse the genetic exams. i've got self assurance this in basic terms applies to the state/federal standards although. some hospitals run much extra issues and that i've got self assurance you're able to refuse those because its on a wellbeing center by using wellbeing center foundation. must you be waiting to maintain all semblance of privateness with regard to the end results of those exams? truthfully.

    • Commenter avatarLogin to reply the answers
  • 7 years ago

    Ok, first call

    SET FMTONLY ON; -- This line will make it so the resulting datatable is just the format of the table

    GO -- you know this part

    Perform your SELECT

    GO -- yep again

    SET FMTONLY OFF; - Turn off request.

    GO - last time

    • Commenter avatarLogin to reply the answers
Still have questions? Get your answers by asking now.