Results 1 to 1 of 1
  1. #1
    Epidural is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    15

    Error 2448: Can't assign a value to this object … Why not?

    Line 2 ( Me.Bathroom = Forms!frmBathrooms!ID ) is tripping the error. Debugger says Me.Bathroom = 1, Forms!frmBathrooms!ID = 38. Basically I'm trying to automatically make this form's Bathroom field match that of the frmBathrooms form's ID. "Me" is a form for items in the bathroom; there can be many items.
    How the hell is that throwing an error? I can't find anything dispite about an hour of searching around. I understand the message, but not how this could be throwing it?
    The Bathroom field of the Item table is in the form's recordsource, etc. Ideas?

    Code:
    Private Sub Form_Open(Cancel As Integer)
      Me.Bathroom = Forms!frmBathrooms!ID
      Me.txtBathInfo.Caption = "Bathroom Room Number: " & DLookup("Room", "tblRooms", "ID = " & DLookup("Room", "tblBathrooms", "ID = " & Me.Bathroom))
      Me.RecordSource = "SELECT * FROM tblStalls WHERE Bathroom = " & Me.Bathroom
      Me.Recordset.AddNew
    End Sub



    FIXED:

    Code:
        Private Sub Form_Open(Cancel As Integer)
        Me.RecordSource = "SELECT * FROM tblStalls WHERE Bathroom = " & Forms!frmBathrooms!ID
        Me.Recordset.AddNew
        Me.Bathroom = Forms!frmBathrooms!ID
        Me.txtBathInfo.Caption = "Bathroom Room Number: " & DLookup("Room", "tblRooms", "ID = " & DLookup("Room", "tblBathrooms", "ID = " & Me.Bathroom))
        End Sub
    Just have to add the new stuff first, then change the values.
    Last edited by Epidural; 05-16-2012 at 01:59 PM. Reason: Solved

Please reply to this thread with any new information or opinions.

Similar Threads

  1. You can't assign a value to this object
    By boywonder in forum Programming
    Replies: 1
    Last Post: 09-08-2011, 04:54 PM
  2. Replies: 2
    Last Post: 07-13-2011, 06:23 AM
  3. Error 2448
    By gtrudel in forum Programming
    Replies: 9
    Last Post: 07-11-2011, 07:30 PM
  4. Replies: 3
    Last Post: 04-15-2010, 09:43 AM
  5. Replies: 3
    Last Post: 03-30-2010, 01:21 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums