Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object doesn't support this property or method

Status
Not open for further replies.

bryn30

Technical User
Mar 5, 2001
57
US
I am trying to archive data. sending a single record to another table. I get the msg box but as soon as I hit yes, it gives me this error "Object doesn't support this property or method". it was giving me a type mismatch error, but after researching this site I fixed it by reprioritizing the DAO reference. here is the code that I am working with. I cannot find the object that this error is talking about. please help. thanks in advance.

If IsNull(Me.OC_Combo) Then
Beep
MsgBox "Please assign this order to an OC agent prior to archiving."
Else:

Dim holder As String
Dim db As DAO.Database
Dim rs As DAO.Recordset

Set db = CurrentDb()
Set rs = db.OpenRecordset("Archive") ' Change name appropriately

holder = MsgBox("Are You Sure You Want To Archive?", vbYesNo)
If vbYes Then

Me.ArcDate = Now()
Me.Archive = True

With rs
.AddNew
' Here is where you would specify what fields you want to add to your second table.
![ID] = Me.ID
![OrderStatus] = Me.OrderStatus
![Case ID] = Me.Case_ID
![Site Name] = Me.Site_Name
![PimsCaseID] = Me.PimsCaseID
![ProductID] = Me.ProductID
![Region] = Me.Region
![Market] = Me.Market
![OrderDate] = Me.OrderDate
![StatusDate] = Me.StatusDate
![Notes] = Me.Notes
![TestTurnUp] = Me.TestTurnUp
![ReasonCode] = Me.ReasonCode
![OC] = Me.OC_Combo
![calday] = Me.calday
![busday] = Me.busday
![OBusDay] = Me.OAB
![OCalDay] = Me.OAC
![ABusDay] = Me.ASAB
![ACalDay] = Me.ASAC
![AdjStatusDate] = Me.StatusDate
![ArcDate] = Me.ArcDate
.Update
.Close
End With
Else
End If

db.Close
DoCmd.SetWarnings False

'Delete the current record
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

End If
Me.Notes.Enabled = False
 
I have tested the code and it done not have any errors with the code ABOVE the DoMenuItems.

If I were you. I would use the docmd.runsql Delete from table where Id = [id] and then requery the table.

good luck.
vickvickvi
 
Thanks vickvickvi
I found the problem, the line

me.archive = true

was pointing to a yes/no field and not the text field "archived"
so I pointed the code to the correct object and it works like a champ.

I again thank you for the help.

I want to say thanks to all you Tip Masters, you all have been a great help with some of these strange request I get.
thank you all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top