Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2011
    Location
    Grand Haven / Royal Oak Michigan USA
    Posts
    23

    Unanswered: Setting Boolean Value

    I am not getting it… this code comes to a screeching halt and is bellyaching “Function call on left-hand side of assignment must return variant or object” when I try to set Form_frmComNet.blnNew = True within the CreateComm_Click

    frmComNet

    Public Function blnNew() As Boolean
    '************************************************* ******************************************
    '* MOD RAL 02/13/2012 Boolean To Add New Communication Using The New Critria *
    '************************************************* ******************************************
    End Function


    Private Sub CreateComm_Click()

    On Error GoTo Err_CreateComm_Click
    'This Routine Opens the Communication Form with the Data Entry set to allow
    'only one record to be added and none to be viewed. It also hides the Search
    'Functions

    '************************************************* ******************************************
    '* MOD RAL 02/13/2012 Boolean To Add New Communication Using The New Critria *
    '************************************************* ******************************************
    Stop
    Form_frmComNet.blnNew = True

    Call DoCmd.OpenForm("frmCommunication")
    DoEvents
    Forms!frmCommunication.txtMode = "Create Communication Mode"
    Forms!frmCommunication.txtDBRNo.Visible = False
    'Forms!frmCommunication.DataEntry = True
    Forms!frmCommunication.cmdSearch.Enabled = False
    Forms!frmCommunication.SaveComm.Enabled = True
    Forms!frmCommunication.SpellCheck.Enabled = True
    Forms!frmCommunication.cmdUpdate.Enabled = False
    Forms!frmCommunication.NavigationButtons = False

    Exit_CreateComm_Click:
    Exit Sub

    Err_CreateComm_Click:
    MsgBox Err.Description
    Resume Exit_CreateComm_Click
    End Sub

    frmCommunication

    Private Sub Form_Load()
    '************************************************* ********************************************
    '* MOD RAL 02/13/2012 Boolean Created On Form_frmComNet To Add New Record Using New Critria *
    '* Or Use The Old Critria To Open A Historic Record *
    '************************************************* ********************************************
    Dim sqlNew As String
    Dim sqlOld As String
    ClaimVolume.Value = ""
    Stop
    If Form_frmComNet.blnNew Then
    sqlNew = " SELECT [Header Table].[Project ID], [Header Table].[Change Request Description], " & _
    " 'N/A' AS [CDD Number], IIf([ProjectType] Is Null, " & _
    " 'Other',IIf([ProjectType]='Database Request','Benefit Change Request', " & _
    " [ProjectType])) AS ProjectTypeDesc, tblLUProjectType.ProjectType, " & _
    " [Header Table].[Requesting Area], [Header Table].[Customer Name] AS RequestorName, " & _
    " 'N/A' AS [Mail Code], 'N/A' AS Phone, [DBR Form].[DBR Number] " & _
    " FROM ([Header Table] LEFT JOIN tblLUProjectType ON [Header Table].[Change Request Type] = " & _
    " tblLUProjectType.ProjectTypeID) LEFT JOIN [DBR Form] ON [Header Table].[Project ID] = " & _
    " [DBR Form].[Project ID] " & _
    " GROUP BY [Header Table].[Project ID], [Header Table].[Change Request Description], " & _
    " 'N/A', IIf([ProjectType] Is Null,'Other',IIf([ProjectType]='Database Request','Benefit Change Request', " & _
    " [ProjectType])), tblLUProjectType.ProjectType, [Header Table].[Requesting Area], " & _
    " [Header Table].[Customer Name], 'N/A', 'N/A', [DBR Form].[DBR Number], " & _
    " [Header Table].[Status Indicators] " & _
    " HAVING ((([Header Table].[Status Indicators])='A' Or ([Header Table].[Status Indicators])='I')) " & _
    " ORDER BY [Header Table].[Project ID] DESC "

    Me.ProjectID.RowSource = sqlNew

    Else
    sqlOld = " SELECT [Header Table].[Project ID], [Header Table].[Change Request Description], " & _
    " [NPR/CPR Form].[CDD Number], IIf([ProjectType] Is Null,'Other',IIf([ProjectType]= " & _
    " 'Database Request','Benefit Change Request',[ProjectType])) AS ProjectTypeDesc, " & _
    " tblLUProjectType.ProjectType, [Header Table].[Requesting Area], [Header Table].[Customer Name] " & _
    " AS RequestorName, [Customer Menu].[Mail Code], [Customer Menu].Phone, [DBR Form].[DBR Number], " & _
    " [Customer Menu].[Customer Name] AS RequestorName1, [Problem ID Form].Category " & _
    " FROM ((([Customer Menu] RIGHT JOIN ([Header Table] LEFT JOIN tblLUProjectType ON " & _
    " [Header Table].[Change Request Type] = tblLUProjectType.ProjectTypeID) ON " & _
    " [Customer Menu].[Customer Name] = [Header Table].[Customer Name]) LEFT JOIN [NPR/CPR Form] ON " & _
    " [Header Table].[Project ID] = [NPR/CPR Form].[Project ID]) LEFT JOIN [DBR Form] ON " & _
    " [Header Table].[Project ID] = [DBR Form].[Project ID]) LEFT JOIN [Problem ID Form] ON " & _
    " [Header Table].[Project ID] = [Problem ID Form].[Project ID] " & _
    " GROUP BY [Header Table].[Project ID], [Header Table].[Change Request Description], " & _
    " [NPR/CPR Form].[CDD Number], IIf([ProjectType] Is Null,'Other',IIf([ProjectType]= " & _
    " 'Database Request','Benefit Change Request',[ProjectType])), tblLUProjectType.ProjectType, " & _
    " [Header Table].[Requesting Area], [Header Table].[Customer Name], [Customer Menu].[Mail Code], " & _
    " [Customer Menu].Phone, [DBR Form].[DBR Number], [Customer Menu].[Customer Name], " & _
    " [Problem ID Form].Category " & _
    " ORDER BY [Header Table].[Project ID] DESC "

    Me.ProjectID.RowSource = sqlOld

    End If

    End Sub
    Rbert

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    what is blnNew?

    also what is the stop statement above the
    Code:
    Form_frmComNet.blnNew = True
    meant to do?
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jan 2011
    Location
    Grand Haven / Royal Oak Michigan USA
    Posts
    23
    blnNew is the Boolean Value to indicate that this will be a new record

    I have the STOP there to stop the code so I can watch what it is doing
    Rbert

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    You have blnNew as a function. You don't "set" the value of a function, functions return values. Based on how you're using it, it looks like you just want it to be a variable declared at either the form level or in a standard module so it's available everywhere. That way you can set or check its value.
    Paul

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    put a break point on the code instead....
    then step through the code

    my first guess was that blnNew was going to be a control..
    but then reading the code BlnNew looks like it is a function and you cannot call a function like that
    the function does nothing, has no parameters so I dont' see what it does
    to call it you could use blnNew()
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Sorry for butting in healdem; it looked like you were offline.
    Paul

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    nae bother,
    there's is no 'posession' of specific threads, y'answer what y'can, when y'can.
    if the OP gets several suggested resolutions then that's fine by me.
    if the OP gets several different suggestions leading to a resolution, thats fine by me
    we are supposed to be controbutors to a community helping others out where we can
    I'd rather be riding on the Tiger 800 or the Norton

  8. #8
    Join Date
    Jan 2011
    Location
    Grand Haven / Royal Oak Michigan USA
    Posts
    23
    Thank you kindly... works like a charm!

    modGlobals

    # '************************************************* ********************************************
    '* MOD RAL 02/14/2012 blnNew Boolean Created On Modules modGlobals To Add A New Communication*
    '************************************************* ********************************************
    Public blnNew As Boolean #

    frmComNet

    # Private Sub CreateComm_click()

    On Error GoTo Err_CreateComm_Click
    'This Routine Opens the Communication Form with the Data Entry set to allow
    'only one record to be added and none to be viewed. It also hides the Search
    'Functions

    '************************************************* ********************************************
    '* MOD RAL 02/14/2012 blnNew Boolean Created On Modules modGlobals To Add A New Communication*
    '************************************************* ********************************************
    blnNew = True

    Call DoCmd.OpenForm("frmCommunication")
    DoEvents
    Forms!frmCommunication.txtMode = "Create Communication Mode"
    Forms!frmCommunication.txtDBRNo.Visible = False
    'Forms!frmCommunication.DataEntry = True
    Forms!frmCommunication.cmdSearch.Enabled = False
    Forms!frmCommunication.SaveComm.Enabled = True
    Forms!frmCommunication.SpellCheck.Enabled = True
    Forms!frmCommunication.cmdUpdate.Enabled = False
    Forms!frmCommunication.NavigationButtons = False

    Exit_CreateComm_Click:
    Exit Sub

    Err_CreateComm_Click:
    MsgBox Err.Description
    Resume Exit_CreateComm_Click
    End Sub #

    frmCommunication

    # Private Sub Form_Load()
    '************************************************* ********************************************
    '* MOD RAL 02/14/2012 blnNew Boolean Created On Modules modGlobals To Add A New Record *
    '* Using New Critria Or Use The Old Critria To Open A Historic Record *
    '************************************************* ********************************************
    Dim sqlNew As String
    Dim sqlOld As String
    ClaimVolume.Value = ""
    Stop
    If blnNew Then
    sqlNew = " SELECT [Header Table].[Project ID], [Header Table].[Change Request Description], " & _
    " 'N/A' AS [CDD Number], IIf([ProjectType] Is Null, " & _
    " 'Other',IIf([ProjectType]='Database Request','Benefit Change Request', " & _
    " [ProjectType])) AS ProjectTypeDesc, tblLUProjectType.ProjectType, " & _
    " [Header Table].[Requesting Area], [Header Table].[Customer Name] AS RequestorName, " & _
    " 'N/A' AS [Mail Code], 'N/A' AS Phone, [DBR Form].[DBR Number] " & _
    " FROM ([Header Table] LEFT JOIN tblLUProjectType ON [Header Table].[Change Request Type] = " & _
    " tblLUProjectType.ProjectTypeID) LEFT JOIN [DBR Form] ON [Header Table].[Project ID] = " & _
    " [DBR Form].[Project ID] " & _
    " GROUP BY [Header Table].[Project ID], [Header Table].[Change Request Description], " & _
    " 'N/A', IIf([ProjectType] Is Null,'Other',IIf([ProjectType]='Database Request','Benefit Change Request', " & _
    " [ProjectType])), tblLUProjectType.ProjectType, [Header Table].[Requesting Area], " & _
    " [Header Table].[Customer Name], 'N/A', 'N/A', [DBR Form].[DBR Number], " & _
    " [Header Table].[Status Indicators] " & _
    " HAVING ((([Header Table].[Status Indicators])='A' Or ([Header Table].[Status Indicators])='I')) " & _
    " ORDER BY [Header Table].[Project ID] DESC "

    Me.ProjectID.RowSource = sqlNew

    Else
    sqlOld = " SELECT [Header Table].[Project ID], [Header Table].[Change Request Description], " & _
    " [NPR/CPR Form].[CDD Number], IIf([ProjectType] Is Null,'Other',IIf([ProjectType]= " & _
    " 'Database Request','Benefit Change Request',[ProjectType])) AS ProjectTypeDesc, " & _
    " tblLUProjectType.ProjectType, [Header Table].[Requesting Area], [Header Table].[Customer Name] " & _
    " AS RequestorName, [Customer Menu].[Mail Code], [Customer Menu].Phone, [DBR Form].[DBR Number], " & _
    " [Customer Menu].[Customer Name] AS RequestorName1, [Problem ID Form].Category " & _
    " FROM ((([Customer Menu] RIGHT JOIN ([Header Table] LEFT JOIN tblLUProjectType ON " & _
    " [Header Table].[Change Request Type] = tblLUProjectType.ProjectTypeID) ON " & _
    " [Customer Menu].[Customer Name] = [Header Table].[Customer Name]) LEFT JOIN [NPR/CPR Form] ON " & _
    " [Header Table].[Project ID] = [NPR/CPR Form].[Project ID]) LEFT JOIN [DBR Form] ON " & _
    " [Header Table].[Project ID] = [DBR Form].[Project ID]) LEFT JOIN [Problem ID Form] ON " & _
    " [Header Table].[Project ID] = [Problem ID Form].[Project ID] " & _
    " GROUP BY [Header Table].[Project ID], [Header Table].[Change Request Description], " & _
    " [NPR/CPR Form].[CDD Number], IIf([ProjectType] Is Null,'Other',IIf([ProjectType]= " & _
    " 'Database Request','Benefit Change Request',[ProjectType])), tblLUProjectType.ProjectType, " & _
    " [Header Table].[Requesting Area], [Header Table].[Customer Name], [Customer Menu].[Mail Code], " & _
    " [Customer Menu].Phone, [DBR Form].[DBR Number], [Customer Menu].[Customer Name], " & _
    " [Problem ID Form].Category " & _
    " ORDER BY [Header Table].[Project ID] DESC "

    Me.ProjectID.RowSource = sqlOld

    End If

    End Sub #
    Rbert

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •