Property not found - only getting error since upgrading to 2010

BonnieG

Registered User.
Local time
Today, 17:54
Joined
Jun 13, 2012
Messages
79
Our department users an MS Access database file created in an old version of access. The purpose is to maintain records of what access our IT users have to our systems.

Since upgrading to Access 2010 I have been getting a "Property not found" error upon using the existing Save button on multiple forms. The error occurs only when data in the record has changed. Converting the old .mdb file to .accdb format hasn't solved the issue.

The Save buttons have "On Click" event procedures associated with them.

The first one is as follows:

Code:
Private Sub cmd_save_Click()
On Error GoTo Err_cmd_save_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Me!txt_existing_zam.Value = ""
Set qresults = CurrentDb.OpenRecordset("select * from qry_zam_function_set")
Do While Not qresults.EOF
zam_access_level = Forms!frm_get_uid.Controls(qresults.Fields(1)).Value
If IsNull(zam_access_level) Then
Else
zam_function = qresults.Fields(0)
'MsgBox zam_function
'MsgBox zam_access_level
Forms!frm_get_uid.[txt_existing_zam].Value = Forms!frm_get_uid.[txt_existing_zam].Value & zam_function & "\" & zam_access_level & " "
End If
qresults.MoveNext
Loop
qresults.Close
Forms!frm_new_user.Requery
Exit_cmd_save_Click:
    Exit Sub
Err_cmd_save_Click:
    MsgBox Err.Description
    Resume Exit_cmd_save_Click
    
End Sub

The other one I am having issues with is this, on a different form:

Code:
Private Sub cmd_save_Click()
On Error GoTo Err_cmd_save_Click
If IsNull(created_by) Or created_by = "" Then
created_by.Value = Environ("username")
End If
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
uidstring = uidstring & Forms![frm_new_user]![HRI_UID_PC] & Forms![frm_new_user]![CHH_UID_PC]
uidstring = uidstring & Forms![frm_new_user]![PRH_UID_PC] & Forms![frm_new_user]![BWH_UID_PC]
uidstring = uidstring & Forms![frm_new_user]![WAC_UID_PC] & Forms![frm_new_user]![ABH_UID_PC]
uidstring = uidstring & Forms![frm_new_user]![BSHC_UID_PC] & Forms![frm_new_user]![FREE_UID_PC]
uidstring = uidstring & Forms![frm_new_user]![BUPA_UID_PC] & Forms![frm_new_user]![NUFF_UID_PC]
uidstring = uidstring & Forms![frm_new_user]![HCH_UID_PC] & Forms![frm_new_user]![WTH_UID_PC]
uidstring = uidstring & Forms![frm_new_user]![BDH_UID_PC] & Forms![frm_new_user]![SGH_UID_PC]
uidstring = uidstring & Forms![frm_new_user]![HRIAE_UID]
Exit_cmd_save_Click:
    Exit Sub
Err_cmd_save_Click:
    MsgBox Err.Description
    Resume Exit_cmd_save_Click
    
End Sub

I have no idea where to even start with figuring it out as the error doesn't even try to take me into Debug mode - it's a very unhelpful error with an "OK" button and nothing more!

Any ideas? :confused:
 
If you temporarily comment out the "On Error..." line and run the code, you should be offered the debug option.
 
Ahhh thank you - that has told me the problem is with this bit:

Code:
Forms!frm_new_user.Requery

This code hasn't changed since the old version. Can Requery no longer be used? frm_new_user is open in the background, behind the existing form, so it's definitely there and available to be requeried...
 
That's a stumper, because Requery is still available. I'll see if I can find something.
 
Thanks so much. I really appreciate it, as it's driving me a little crazy now! :(
 
The other form's debug info is highlighting this line of code as the problem area:

Code:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Again, this isn't new code and it worked in Access 2003. :confused:
 
The DoCmd.DoMenuItem is replaced by Docmd.Runcommand for backwards compatibility most of te DoMenItem stil work, this one may not.
For more information see this MSDN page
 
Hmm interesting. Is the syntax the same? I've changed the code as follows:

Code:
DoCmd.RunCommand acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

However I now get the Compile Error "Wrong number of arguments or invalid property assignment".
 
The syntax is not the same as there's no reference to the menu, to save a record the syntax is:
Code:
docmd.RunCommand acCmdSaveRecord
 
Great, thank you. :)

I've replaced all occurences of that line with what you suggested, however I'm still getting "Property Not Found" on one form when I try to save, when the data has changed...

Code:
Private Sub cmd_save_Click()
'On Error GoTo Err_cmd_save_Click
DoCmd.RunCommand acCmdSaveRecord
Me!txt_existing_zam.Value = ""
Set qresults = CurrentDb.OpenRecordset("select * from qry_zam_function_set")
Do While Not qresults.EOF
zam_access_level = Forms!frm_get_uid.Controls(qresults.Fields(1)).Value
If IsNull(zam_access_level) Then
Else
zam_function = qresults.Fields(0)
'MsgBox zam_function
'MsgBox zam_access_level
Forms!frm_get_uid.[txt_existing_zam].Value = Forms!frm_get_uid.[txt_existing_zam].Value & zam_function & "\" & zam_access_level & " "
End If
qresults.MoveNext
Loop
qresults.Close
[COLOR=black][B][I]Forms!frm_new_user.Requery
[/I][/B][/COLOR]Exit_cmd_save_Click:
    Exit Sub
Err_cmd_save_Click:
    MsgBox Err.Description
    Resume Exit_cmd_save_Click
    
End Sub

I've highlighed the line which is highlighted yellow in the VB code when I click Debug.

If anyone has any suggestions I'd be really grateful as this one is driving me mad!
 
I don't have Access 2010 here, "Property Not Found" message for a requery tells me that access does not know where to look. Try:
Code:
Forms!frm_new_user[B].Form[/B].Requery
In Access 2003 the code runs with and without the .form.
 
Thanks for the suggestion, but unfortunately that makes no difference. :(

I am now wondering if I need to save the other form before attempting to requery it?

I have two forms open - frm_new_user and frm_get_uids. I'm getting the error on the Save command on frm_get_uids (which contains some, but not all, of the same fields as on frm_new_user). Saving frm_get_uids updates frm_new_user successfully but gives the error.

I've noticed that when I change data on frm_get_uids and hit Save, there's no error and the new values copy to frm_new_user with no problem. If I then make FURTHER changes on frm_new_uids and hit Save, I get the error. So it's like the Requery function is trying to requery frm_new_user, finding there's been no save since the last change, and erroring... possibly?!!

In which case I'd need to put in another line above the "Forms!frm_new_user.Requery" to save frm_new_user... any idea what the syntax for that would be (if you agree that might be the problem)?
 

Users who are viewing this thread

Back
Top Bottom