I have two Forms Form1 and Form2.
On form One I have a command button which is called View. On Form2 I have a Datagrid. What I would like to do is when click the command on form one called View Form 2 would load. Which I already have this codes. When Form 2 load up I would like to retrive the Data from my Access table Called ADP. This is where I need help connecting to Access and the codes to load the table on form 2
[Edited by ozzy on 16-05-2003 at 07:34 PM GMT]
17-05-2003 at 07:33 AM
|
~Bean~ Level: VB Guru Registered: 07-04-2003 Posts: 488
Re: Connecting with Access
So you need to load the data from your access table into a datagrid?
If you are using the "DBGrid" or "DataGrid", it is designed to be bound to another data control/source (i.e., an ADODC or a Data Environment)...simply add an ADODC control to your form (and set its data properties to your Access database) then set the DBGrid's DataSource property to the ADODC. The "Datagrid" control is similar to the "DBGrid", but does not support being "unbound".
____________________________
Eggheads unite! You have nothing to lose but your yolks.
19-05-2003 at 05:38 PM
|
ozzy Level: Guest
Re: Connecting with Access
quote:~Bean~ wrote:
So you need to load the data from your access table into a datagrid?
If you are using the "DBGrid" or "DataGrid", it is designed to be bound to another data control/source (i.e., an ADODC or a Data Environment)...simply add an ADODC control to your form (and set its data properties to your Access database) then set the DBGrid's DataSource property to the ADODC. The "Datagrid" control is similar to the "DBGrid", but does not support being "unbound".
ok I already have the ADODC control on my form I need to load up my code right. So how woul I do that.
22-05-2003 at 04:46 AM
|
~Bean~ Level: VB Guru Registered: 07-04-2003 Posts: 488
Re: Connecting with Access
If I understand your problem, you should not need any code. The ADODC will open the connection without any code(once you have set it's database properties), and the Datagrid will populate with data from the ADODC without any code (once you have set it's datasource property).
____________________________
Eggheads unite! You have nothing to lose but your yolks.
22-05-2003 at 01:14 PM
|
ozzy Level: Guest
Re: Connecting with Access
quote:~Bean~ wrote:
If I understand your problem, you should not need any code. The ADODC will open the connection without any code(once you have set it's database properties), and the Datagrid will populate with data from the ADODC without any code (once you have set it's datasource property).
I have everything working I have a slight problem. This is how it starts I run my project correct. When my Form1 show everything is the way I want it to be. when the user click on the View Command buttom. Form 2 load up, When form two load up it doesn't display the information like the way I have it in Access. All it show me is Date and on the Bottom of the date it says NULL the same thing is happenning to Time User and so on. What is the problem here??/
[Edited by ozzy on 22-05-2003 at 10:24 AM GMT]
22-05-2003 at 10:21 PM
|
~Bean~ Level: VB Guru Registered: 07-04-2003 Posts: 488
Re: Connecting with Access
I am not familiar enough with VB.NET to help you further...I know some controls, such as the Date/Time Picker, have trouble displaying null values...but why your other fields like User, etc. would be showing that is beyond me...the datagrid control 6.0 I use displays null dates/times as blanks, not as "NULL".
____________________________
Eggheads unite! You have nothing to lose but your yolks.
23-05-2003 at 12:33 AM
|
ozzy Level: Guest
Re: Connecting with Access
quote:~Bean~ wrote:
I am not familiar enough with VB.NET to help you further...I know some controls, such as the Date/Time Picker, have trouble displaying null values...but why your other fields like User, etc. would be showing that is beyond me...the datagrid control 6.0 I use displays null dates/times as blanks, not as "NULL".
Thank you for all your HELP. If I have any further question wouldn't you mind if I email you.
23-05-2003 at 05:14 AM
|
~Bean~ Level: VB Guru Registered: 07-04-2003 Posts: 488
Re: Connecting with Access
e-mail me anytime. I will continue to check this thread as well in case I can help...in the meantime...maybe you can help me!?!
...I installed my VB.NET last night just for you! lol...and I tried to duplicate the problem you have. HAH! I can't even get the datasource of the Datagrid set...this will not set in design view (?) what code are you using to do this? "SetBindings"?
____________________________
Eggheads unite! You have nothing to lose but your yolks.