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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"You can't assign a value to this object" error msg 2

Status
Not open for further replies.

newguy86

Technical User
May 19, 2008
226
US
The subject line is the error message that I get when I try to set the value of a yes/no field through code and I cannot figure out what's causing the issue.

Here's my code (the part in red is where my code stops working):

Code:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
    
    Dim strUserID As String
    Dim DueDate As Date
    Dim DateCompleted As Date
    
    DoCmd.SetWarnings False
    
    DoCmd.RunMacro "mcrMaximize"
    
    strUserID = GetUserName_TSB
    DueDate = Form_sfrmGDSQADates.DueDate
    DateCompleted = Form_sfrmGDSQADates.DateCompletedGDS
        
    If DueDate < DateCompleted Then
        [COLOR=red]Form_frmGDSQA.TimeN1 = True[/color red]
        Form_frmGDSQA.TimeY1 = False
    Else
        Form_frmGDSQA.TimeN1 = False
        Form_frmGDSQA.TimeY1 = True
    End If
    
    DoCmd.SetWarnings True
        
Exit_Form_Open:
    Exit Sub

Err_Form_Open:
    DoCmd.SetWarnings True
    MsgBox Err.Description
    Resume Exit_Form_Open
End Sub

Any help that you guys can provide would be appreciated.

Travis
 
The open event event happens before the load event. It happens when the form opens but before the first record is displayed. At that time the forms query has run, but the data is not yet bound to the controls. Therefore you cannot yet modify the value of controls. You can however, modify other control properties.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top