Results 1 to 6 of 6
  1. #1
    snoopy is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    53

    Need help in crating a status msg.

    Hi there lovely Community,



    I urgently need your help in creating a status message. So I have a dropdown menu with seven cases. If the user chose one of three cases of completely seven (s)he also should to fill out a text box. Unfortunately I have no idea how to do this.

    I totally thanking you for your help

  2. #2
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    When you say
    should to fill out a text box
    what do you mean? I shall presume you mean ordinarily it should not be visible.

    Therefore set the visible property to no on the relevant textbox (txt_details)

    You need to use vb for this.

    In the afterupdate event for the list/combobox (cbo_items) try something like

    Code:
    if cbo_items="whatever the case is" then
    txt_details.visible=true
    endif

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Where ComboName is the actual name of your Combobox, TargetTextbox is the actual name of the Texbox in question and 'Selection1', 'Selection2' and 'Selection3' are the values in the Bound Column that if selected, require that the Textbox be Visible to be filled in.
    Code:
    Private Sub ComboName_AfterUpdate()
     
     Select Case Me.ComboName
      
      Case "Selection1", "Selection2", "Selection3"
        TargetTextbox.Visible = True
      
      Case Else
        TargetTextbox.Visible = False
      
     End Select
    
    End Sub
    
    
    Private Sub Form_Current()
    
     Select Case Me.ComboName
      
      Case "Selection1", "Selection2", "Selection3"
        TargetTextbox.Visible = True
      
      Case Else
        TargetTextbox.Visible = False
      
     End Select
    
    End Sub


    Note that this will only work with a Single View Form. Formatting like this, in Continuous or Datasheet View Forms, has to be done using Conditional Formatting off of the Format Menu, and you cannot format Visibilty using CF. You'd have to control the Enable Property, which can be done thru CF.

    BTW, the code in the Form_Current event is required so that when moving from Record to Record, the formatting will be appropriate for that particular Record.

    Linq ;0)>

  4. #4
    snoopy is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    53
    No this is not actually really what I am searching for. In my case I need a instruction, which checks either if a text box empty or not, when the user selects a specific value of an dropdown.

    I've wrote following code but that seems to be not working. Sorry my VBA-Skills are totally bad


    Private Sub Form_Current()
    If Me.Combo471.Column(3) = True Then
    If IsNull(Entscheidung in) Then
    MsgBox("Lorem Ipsum?", vbOKonly, "Title")
    Else Then Exit Sub
    If Me.Combo471.Column(4) = True Then
    If IsNull(Entscheidung in) Then
    MsgBox("Lorem Ipsum?", vbOKonly, "Title")
    Else Then Exit Sub
    If Me.Combo471.Column(5) = True Then
    If IsNull(Entscheidung in) Then
    MsgBox("Lorem Ipsum?", vbOKonly, "Title")
    Else Then Exit Sub
    Else Then Exit Sub

    End Sub



    May its logical false or it has to be a different event, I don't know

  5. #5
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    A couple of points here, the combobox dropdown once selected only stores the bound columns datahat means you cants check for other results like you are trying to. Either include the extra fields in your query or use dlookup. I shall assume for the purposes of this that you haven't added the fields to the query (undeniably the easy way)

    If it is for data entry only then you only need to use the afterupdate event on the combobox. (dont forget validation on the beforeupdate form event).

    If it is also used for viewing you will also need it in the oncurrent form event.

    Code:
    Private Sub ComboName_AfterUpdate()
    dim column3 as boolean
    dim column4 as boolean
    dim column5 as boolean
    column3=nz(dlookup("[column3]","[table_name]","[bound_field]='"&[comboname]&"'",false)
    column4=nz(dlookup("[column4]","[table_name]","[bound_field]='"&[comboname]&"'",false)
    column5=nz(dlookup("[column5]","[table_name]","[bound_field]='"&[comboname]&"'",false)
    if isnull([Entscheidung in]) then
      if coloumn3=false then
       MsgBox("Lorem Ipsum?", vbOKonly, "Title")
       elseif coloumn4=false then
       MsgBox("Lorem Ipsum?", vbOKonly, "Title")
       elseif coloumn5=false then
       MsgBox("Lorem Ipsum?", vbOKonly, "Title")
       end if
    end if
    End Sub
    If you add the fields to the query then you can essentially do the same thing without using dlookups.

  6. #6
    snoopy is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    53
    Ok I wrote a sub, which solved my problem. It wasn't so complicated as I thought.

    Private Sub Combo471_AfterUpdate()
    If IsNull(Me![tabB form].Form![Entscheidung in]) Then
    If Me!Combo471 = "3" Or Me!Combo471 = "4" Or Me!Combo471 = "5" Then
    MsgBox "Lorem Ipsum", vbOKOnly, "BlabBla"
    Else
    Exit Sub
    End If
    Else
    Exit Sub
    End If
    End Sub
    Anyway, I am currently searching for a method to make sure that the user could not save the current form.

    I guess it must be something like that

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    If IsNull(Me![tabB form].Form![Entscheidung in]) Then
    If Me!Combo471 = "3" Or Me!Combo471 = "4" Or Me!Combo471 = "5" AND Me![tabB form].Form![Entscheidung in] = "NULL" Then
    Cancel = True
    Else
    Exit Sub
    End If
    Else
    Exit Sub
    End If
    End Sub
    Or could I transfer a variable to the AfterUpdate Sub that tranfer back true or false?

    Anyway how could I put on source code formatting

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

Similar Threads

  1. Search By Status or other criteria
    By timbo in forum Forms
    Replies: 26
    Last Post: 05-14-2012, 03:04 PM
  2. Status (yes/no)
    By combine21 in forum Access
    Replies: 2
    Last Post: 07-26-2011, 02:37 PM
  3. Status Bar Totals
    By ZMac in forum Access
    Replies: 1
    Last Post: 06-08-2011, 01:16 PM
  4. Status reports
    By stosh59 in forum Database Design
    Replies: 2
    Last Post: 01-07-2011, 01:22 PM
  5. Check Box status
    By NOTLguy in forum Forms
    Replies: 5
    Last Post: 11-27-2010, 08:59 PM

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