By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,631 Members | 892 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,631 IT Pros & Developers. It's quick & easy.

You can't assign a value to this object Error!

P: 129
Hi i have created a Sales Order Header with a Sales Order Line (1 to many relationship) See Picture for image of error! I receive this error when inputting data into the sfrmSOHeader in Add mode. I get this error then i can input data like normal. I dont know why i receive this error but i must get rid of it. The control is not read only, or design-view and definately not too large.

Here is the sfrmSOHeader On Current Code;

Expand|Select|Wrap|Line Numbers
  1.     Dim ParentDocName As String
  3.     On Error Resume Next
  4.     ParentDocName = Me.Parent.Name
  6.     If err <> 0 Then
  7.         GoTo Form_Current_Exit
  8.     Else
  9.         On Error GoTo Form_Current_Err
  10.         Me.Parent![sfrmSOLine].Requery
  11.     End If
  13.     DoCmd.SetWarnings False
  15.     If Me.OrderStatus.Value = -1 Then
  16.         Me.Form.AllowAdditions = False
  17.         Me.Form.AllowDeletions = False
  18.         Me.Form.AllowEdits = False
  19.         Me.cmdDeleteHeader.Enabled = False
  20.         Me.cmdProcessHeader.Enabled = False
  21.         Me.cmdSave.Enabled = False
  22.         [Forms]![frmCustomerOrderForm]![cmdImportCSVFile].Enabled = False
  23.         [Forms]![frmCustomerOrderForm]![cmdAddNewItem].Enabled = False
  24.         [Forms]![frmCustomerOrderForm]![sfrmSOLine].Form.AllowAdditions = False
  25.         [Forms]![frmCustomerOrderForm]![sfrmSOLine].Form.AllowDeletions = False
  26.         [Forms]![frmCustomerOrderForm]![sfrmSOLine].Form.AllowEdits = False
  27.         [Forms]![frmCustomerOrderForm]![sfrmSOLine]![cmdDeleteRec].Enabled = False
  28.     Else
  29.         Me.Form.AllowAdditions = True
  30.         Me.Form.AllowDeletions = True
  31.         Me.Form.AllowEdits = True
  32.         Me.cmdDeleteHeader.Enabled = True
  33.         Me.cmdProcessHeader.Enabled = True
  34.         Me.cmdSave.Enabled = True
  35.         [Forms]![frmCustomerOrderForm]![cmdImportCSVFile].Enabled = True
  36.         [Forms]![frmCustomerOrderForm]![cmdAddNewItem].Enabled = True
  37.         [Forms]![frmCustomerOrderForm]![sfrmSOLine].Form.AllowAdditions = True
  38.         [Forms]![frmCustomerOrderForm]![sfrmSOLine].Form.AllowDeletions = True
  39.         [Forms]![frmCustomerOrderForm]![sfrmSOLine].Form.AllowEdits = True
  40.         [Forms]![frmCustomerOrderForm]![sfrmSOLine]![cmdDeleteRec].Enabled = True
  41.     End If
And this is the cmdNewOrderNo Button On Click Code;

Expand|Select|Wrap|Line Numbers
  1.     'Sets the sfrmSOHeader.AllowDetails to True and the Visibility of Fields to True / False
  2.     'Sets sfrmSOHeader to move to NewRecord
  3.     Me.sfrmSOHeader.Form.AllowAdditions = True
  4.     Me.sfrmSOHeader.Form.AllowDeletions = True
  5.     Me.sfrmSOHeader.Form.AllowEdits = True
  6.     [Forms]![frmCustomerOrderForm]![sfrmSOHeader].Visible = True
  7.     [Forms]![frmCustomerOrderForm]![sfrmSOLine].Visible = False
  8.     keybox.Visible = False
  9.     lblOrderLine.Visible = False
  10.     cmdImportCSVFile.Visible = False
  11.     cmdAddNewItem.Visible = False
  12.     cmdGeneratePOrders.Visible = False
  13.     cmdOrderMaintenance.Visible = False
  14.     DoCmd.GoToControl "sfrmSOHeader"
  15.     DoCmd.GoToRecord , , acNewRec
  16.     [Forms]![frmCustomerOrderForm]![sfrmSOHeader]![OrderDate].SetFocus
  17.     'Reset the List lstCustOrderNo Field
  18.     Me.lstCustOrderNo.Value = ""
The reason for all the AllowAdditions, Edits and Deletions is because one of my requirements is to lock down the Orders when completed. If anyone can suggest how or why i receive this error it would be greatly appreciated!

p.s. The is more like a nuisance than an actual error but have trie many times to get rid but feel the problem maybe due to the allowadditions, deletions and edits code.
Attached Images
File Type: bmp Error.bmp (13.0 KB, 113 views)
Oct 31 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 5K+
P: 8,627
For starters, set a Breakpoint in Line #4 in the Current() Event of the Sub-Form, then Single Step (F8) thought he code, Repeat this process in the Click() Event, if the Error is happening there. This will pinpoint the Line on which the Error occurs. If you do not know how to set a Breakpoint, let me know.
Nov 1 '08 #2

P: 129
Hi i have managed to find the problem, it is to do with my Master and Child Links but haven't managed to fix it yet.

The Main Form consists of Three Entities; 1 Main Form and 2 Sub-Forms, all which are linked. The Names of the Entities are frmCustomerOrderForm, sfrmSOHeader and sfrmSOLine.

The Master and Child Link from CustomerOrderForm to sfrmSOHeader is 'CustNo' Key Field. The Master and Child Link from sfrmSOHeader to sfrmSOLine is 'OrderNo' Key Field.

I have changed the Links to what they should be and its works fine thanks. Origanlly the Links had two references from the CustomerOrderForm to the sfrmSOHeader. I had 'CustNo' and 'OrderNo' Fields set as the Master and Child Links. Taking off the OrderNo reference link made it work fine now. Thanks again!
Nov 3 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.