![]() |
| ||
| ADDNEW Method Problem Hi All I am using MS ACCESS 2003 and VB version 6.0.I made a Blank database in ACCESS with a table having fields Username & Password. My VB application consists of 2 textboxes and a command button. I established the connection using "Microsoft.Jet.OLEDB.4.0"(coz i tried first 3.51 but it wasnt working). In the RECORDSOURCE Tab , I specified the CommandType as "adcmdTable" and selected my fresh table(Having no data). For filling my fresh table: I tried the following code in the Command1_Click() Private Sub Command1_Click() With Adodc1.Recordset .AddNew .Fields(0) = Text1.Text .Fields(1) = Text2.Text .Update End With End Sub Even I tried :(Just to verify) Private Sub Command1_Click() With Adodc1.Recordset .AddNew .Fields("Username") = Text1.Text .Fields("Password") = Text2.Text .Update End With End Sub I am getting the following error: Run time error-91: Object variable or with block not set.. I tried every approach I was able to find but no use. Please help me out. |
| ||
| Re: ADDNEW Method Problem Hi, this does not seem to be complicated. Please change the command click sub as follows. Please dim both the recordset and the connection before running the code. Imagine: conn = the connection, and rs = the recordset
This should work. Good luck! |
| All times are GMT -4. The time now is 4:13 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC