Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Problem with Data1.recordset.AddNew

 
   Database Forums (Home) -> Visual Basic -> DAO RSS
Next:  Timeout expired problem  
Author Message
Wayne & Kerri Anne

External


Since: Mar 03, 2006
Posts: 13



(Msg. 1) Posted: Mon Jul 17, 2006 6:51 pm
Post subject: Problem with Data1.recordset.AddNew
Archived from groups: microsoft>public>vb>database>dao (more info?)

Hi All

I have a Access97 Database and if I delete all the records compat the
database when I use AddNew I get an error message Runtime Error '3426': This
action was cancelled by an associated object. and highlights the
Data1.recodset.AddNew line in the command button event.

Code:

Private Sub cmdNewWorkOrder_Click()

Data1.Recordset.AddNew
Call ResetOptions
Call cmd_Click
Loadini
Combo1.Text = KeyValue

End Sub

Private Sub Form_Load()
'SETUP FOR SCREEN CHANGE RESOLUTION
Dim IniSectionName, IniFileName As String
Dim ResXkey, ResXVal, ResYkey, ResYVal, ResColorKey, ResColorVal As String
Dim IniStat As Long
Call GetScreenResolution(xres, yres)
Call GetAvailableColours(rColor)
IniFileName = App.Path & "\Raptis.ini"
IniSectionName = "ScreenRes"
ResXkey = "XRes"
ResYkey = "YRes"
ResColorKey = "Colors"
ResXVal = xres
ResYVal = yres
ResColorVal = rColor

IniStat = WriteINI(IniSectionName, ResXkey, ResXVal, IniFileName)
IniStat = WriteINI(IniSectionName, ResYkey, ResYVal, IniFileName)
IniStat = WriteINI(IniSectionName, ResColorKey, ResColorVal,
IniFileName)


'Set resolution when loading program Change these numbers to desired
Resolution and colors
'useage ChangeScreenSettings Xresolution, YResolution, Colors
ChangeScreenSettings 1024, 768, 32
Call sCenterForm(Me)
Data1.DatabaseName = (App.Path & "\raptis.mdb")
Data1.RecordSource = "tblWorkOrders"
Data2.DatabaseName = (App.Path & "\raptis.mdb")
Data2.RecordSource = "qryStaffNames" 'Using the query because it is
sorted
Data3.DatabaseName = (App.Path & "\raptis.mdb")
Data3.RecordSource = "tblStreet"
Data4.DatabaseName = (App.Path & "\raptis.mdb")
Data4.RecordSource = "tblSuburbs"
Data5.DatabaseName = (App.Path & "\raptis.mdb")
Data5.RecordSource = "tblFireAnt"
Data6.DatabaseName = (App.Path & "\raptis.mdb")
Data7.DatabaseName = (App.Path & "\Raptis.mdb")
Data9.DatabaseName = (App.Path & "\Raptis.mdb")
Data9.RecordSource = "tblPriority"

WO = SendMessageLong(Combo2.hWnd, CB_SETDROPPEDWIDTH, 190, 0)
BM = SendMessageLong(Combo3.hWnd, CB_SETDROPPEDWIDTH, 190, 0)
PC = SendMessageLong(Combo4.hWnd, CB_SETDROPPEDWIDTH, 190, 0)
US = SendMessageLong(Combo5.hWnd, CB_SETDROPPEDWIDTH, 190, 0)

'LOAD DISTRICT INFORMATION IN TO COMBO1.TEXT
KeySection = "District"
KeyKey = "District"
Loadini
Combo1.Text = KeyValue
End Sub


Thank for any help on this subject

Wayne

 >> Stay informed about: Problem with Data1.recordset.AddNew 
Back to top
Login to vote
Paul Clement

External


Since: Sep 02, 2003
Posts: 526



(Msg. 2) Posted: Mon Jul 17, 2006 6:51 pm
Post subject: Re: Problem with Data1.recordset.AddNew [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Mon, 17 Jul 2006 18:51:20 +1000, "Wayne & Kerri Anne" wrote:

¤ Hi All
¤
¤ I have a Access97 Database and if I delete all the records compat the
¤ database when I use AddNew I get an error message Runtime Error '3426': This
¤ action was cancelled by an associated object. and highlights the
¤ Data1.recodset.AddNew line in the command button event.
¤
¤ Code:
¤
¤ Private Sub cmdNewWorkOrder_Click()
¤
¤ Data1.Recordset.AddNew
¤ Call ResetOptions
¤ Call cmd_Click
¤ Loadini
¤ Combo1.Text = KeyValue
¤
¤ End Sub
¤
¤ Private Sub Form_Load()
¤ 'SETUP FOR SCREEN CHANGE RESOLUTION
¤ Dim IniSectionName, IniFileName As String
¤ Dim ResXkey, ResXVal, ResYkey, ResYVal, ResColorKey, ResColorVal As String
¤ Dim IniStat As Long
¤ Call GetScreenResolution(xres, yres)
¤ Call GetAvailableColours(rColor)
¤ IniFileName = App.Path & "\Raptis.ini"
¤ IniSectionName = "ScreenRes"
¤ ResXkey = "XRes"
¤ ResYkey = "YRes"
¤ ResColorKey = "Colors"
¤ ResXVal = xres
¤ ResYVal = yres
¤ ResColorVal = rColor
¤
¤ IniStat = WriteINI(IniSectionName, ResXkey, ResXVal, IniFileName)
¤ IniStat = WriteINI(IniSectionName, ResYkey, ResYVal, IniFileName)
¤ IniStat = WriteINI(IniSectionName, ResColorKey, ResColorVal,
¤ IniFileName)
¤
¤
¤ 'Set resolution when loading program Change these numbers to desired
¤ Resolution and colors
¤ 'useage ChangeScreenSettings Xresolution, YResolution, Colors
¤ ChangeScreenSettings 1024, 768, 32
¤ Call sCenterForm(Me)
¤ Data1.DatabaseName = (App.Path & "\raptis.mdb")
¤ Data1.RecordSource = "tblWorkOrders"
¤ Data2.DatabaseName = (App.Path & "\raptis.mdb")
¤ Data2.RecordSource = "qryStaffNames" 'Using the query because it is
¤ sorted
¤ Data3.DatabaseName = (App.Path & "\raptis.mdb")
¤ Data3.RecordSource = "tblStreet"
¤ Data4.DatabaseName = (App.Path & "\raptis.mdb")
¤ Data4.RecordSource = "tblSuburbs"
¤ Data5.DatabaseName = (App.Path & "\raptis.mdb")
¤ Data5.RecordSource = "tblFireAnt"
¤ Data6.DatabaseName = (App.Path & "\raptis.mdb")
¤ Data7.DatabaseName = (App.Path & "\Raptis.mdb")
¤ Data9.DatabaseName = (App.Path & "\Raptis.mdb")
¤ Data9.RecordSource = "tblPriority"
¤
¤ WO = SendMessageLong(Combo2.hWnd, CB_SETDROPPEDWIDTH, 190, 0)
¤ BM = SendMessageLong(Combo3.hWnd, CB_SETDROPPEDWIDTH, 190, 0)
¤ PC = SendMessageLong(Combo4.hWnd, CB_SETDROPPEDWIDTH, 190, 0)
¤ US = SendMessageLong(Combo5.hWnd, CB_SETDROPPEDWIDTH, 190, 0)
¤
¤ 'LOAD DISTRICT INFORMATION IN TO COMBO1.TEXT
¤ KeySection = "District"
¤ KeyKey = "District"
¤ Loadini
¤ Combo1.Text = KeyValue
¤ End Sub
¤
¤

You might want to see if the following applies:

FIX: Error 3315 or 3426 When Updating a Bound DBCombo Box
http://support.microsoft.com/default.aspx?scid=kb;en-us;189678


Paul
~~~~
Microsoft MVP (Visual Basic)

 >> Stay informed about: Problem with Data1.recordset.AddNew 
Back to top
Login to vote
liamfitz

External


Since: Oct 24, 2006
Posts: 5



(Msg. 3) Posted: Tue Oct 24, 2006 4:31 pm
Post subject: RE: Problem with Data1.recordset.AddNew [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Try using the .update method after the .addnew method. In between of course
you need to specify the field and the new data.

"Wayne & Kerri Anne" wrote:

> Hi All
>
> I have a Access97 Database and if I delete all the records compat the
> database when I use AddNew I get an error message Runtime Error '3426': This
> action was cancelled by an associated object. and highlights the
> Data1.recodset.AddNew line in the command button event.
>
> Code:
>
> Private Sub cmdNewWorkOrder_Click()
>
> Data1.Recordset.AddNew
> Call ResetOptions
> Call cmd_Click
> Loadini
> Combo1.Text = KeyValue
>
> End Sub
>
> Private Sub Form_Load()
> 'SETUP FOR SCREEN CHANGE RESOLUTION
> Dim IniSectionName, IniFileName As String
> Dim ResXkey, ResXVal, ResYkey, ResYVal, ResColorKey, ResColorVal As String
> Dim IniStat As Long
> Call GetScreenResolution(xres, yres)
> Call GetAvailableColours(rColor)
> IniFileName = App.Path & "\Raptis.ini"
> IniSectionName = "ScreenRes"
> ResXkey = "XRes"
> ResYkey = "YRes"
> ResColorKey = "Colors"
> ResXVal = xres
> ResYVal = yres
> ResColorVal = rColor
>
> IniStat = WriteINI(IniSectionName, ResXkey, ResXVal, IniFileName)
> IniStat = WriteINI(IniSectionName, ResYkey, ResYVal, IniFileName)
> IniStat = WriteINI(IniSectionName, ResColorKey, ResColorVal,
> IniFileName)
>
>
> 'Set resolution when loading program Change these numbers to desired
> Resolution and colors
> 'useage ChangeScreenSettings Xresolution, YResolution, Colors
> ChangeScreenSettings 1024, 768, 32
> Call sCenterForm(Me)
> Data1.DatabaseName = (App.Path & "\raptis.mdb")
> Data1.RecordSource = "tblWorkOrders"
> Data2.DatabaseName = (App.Path & "\raptis.mdb")
> Data2.RecordSource = "qryStaffNames" 'Using the query because it is
> sorted
> Data3.DatabaseName = (App.Path & "\raptis.mdb")
> Data3.RecordSource = "tblStreet"
> Data4.DatabaseName = (App.Path & "\raptis.mdb")
> Data4.RecordSource = "tblSuburbs"
> Data5.DatabaseName = (App.Path & "\raptis.mdb")
> Data5.RecordSource = "tblFireAnt"
> Data6.DatabaseName = (App.Path & "\raptis.mdb")
> Data7.DatabaseName = (App.Path & "\Raptis.mdb")
> Data9.DatabaseName = (App.Path & "\Raptis.mdb")
> Data9.RecordSource = "tblPriority"
>
> WO = SendMessageLong(Combo2.hWnd, CB_SETDROPPEDWIDTH, 190, 0)
> BM = SendMessageLong(Combo3.hWnd, CB_SETDROPPEDWIDTH, 190, 0)
> PC = SendMessageLong(Combo4.hWnd, CB_SETDROPPEDWIDTH, 190, 0)
> US = SendMessageLong(Combo5.hWnd, CB_SETDROPPEDWIDTH, 190, 0)
>
> 'LOAD DISTRICT INFORMATION IN TO COMBO1.TEXT
> KeySection = "District"
> KeyKey = "District"
> Loadini
> Combo1.Text = KeyValue
> End Sub
>
>
> Thank for any help on this subject
>
> Wayne
>
>
>
 >> Stay informed about: Problem with Data1.recordset.AddNew 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Problem with "Recordset.Edit" on a "DataEntry" form in Ace.. - I have a form (called "MainForm") whose "DataEntry" property is set to "true" and whose "RecordSource" property is set to table "MainTable", which itself contains two string fields naned "main1"...

dao recordset error trapping - I have a dao recordset which I update with the following code: With rsOrderShip .Edit !CustCode = frmOrders.txtSTCustCode.Text !stcustname = frmOrders.txtSTCustName.Text !staddress1 = frmOrders.txtSTAddress1.Text ....

Error 3167 recordset is delete - Hello, ich habe in verschiedenen Newsgroups gesucht aber keine Lösung zu dem folgenden Problem gefunden. Zwei Personen arbeiten gemeinsam mit einem VB6-Programm an einer ACCESS 2000 Datenbank Der Zugriff von VB auf ACCESS erfolgt mit DAO 3.60. Eine de...

Deleting records from DAO recordset - [posted earlier in other group] Hi All, I'm using the following code to delete one or more records from a DAO recordset. The code is working but I was wondering if I need to Update the recordset with: rsDel.Update? Public Function DelRecs(Lstview As....

ADOR.RecordSet and Vista - I've inherited two sets of VB6 based com components from another developer. A set of client side activeX controls and a set of server side com controls. Basically, browser activated client side activex controls invokes server side control on Windows....
   Database Forums (Home) -> Visual Basic -> DAO All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]