12 Replies - 342 Views - Last Post: 28 January 2012 - 04:52 AM Rate Topic: -----

Topic Sponsor:

#1 oMADMANo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 21-January 12

Still visible/nonvisible on next member ?

Posted 24 January 2012 - 06:59 AM

Okay i have my code set up like this:
Private Sub Check77_BeforeUpdate(Cancel As Integer)

If Me.Check77 = False Then

Me.Risks.Visible = False
Me.Risk1.Visible = False
Me.RiskText.Visible = False
Me.Risk1text.Visible = False
Me.RiskButton.Visible = False

ElseIf Me.Check77 = True Then

Me.Risks.Visible = True
Me.Risk1.Visible = True
Me.RiskText.Visible = True
Me.Risk1text.Visible = True
Me.RiskButton.Visible = True

End If

End Sub

Private Sub Check77_Click()

If Me.Check77 = False Then

Me.Risks.Visible = False
Me.Risk1.Visible = False
Me.RiskText.Visible = False
Me.Risk1text.Visible = False
Me.RiskButton.Visible = False

ElseIf Me.Check77 = True Then

Me.Risks.Visible = True
Me.Risk1.Visible = True
Me.RiskText.Visible = True
Me.Risk1text.Visible = True
Me.RiskButton.Visible = True

End If

End Sub



The problem I am having is that if I select or de select my tick box even though the next record is not selected the items are still visible on the next page.
I would like it set up so that it only applies if that records tick box is or isn't checked.
Sorry for all the questions I am a bit of a programming noob but your help is much appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: Still visible/nonvisible on next member ?

#2 oMADMANo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 21-January 12

Re: Still visible/nonvisible on next member ?

Posted 24 January 2012 - 07:30 AM

Tried placing

If Me.Check77 = False Then

Me.Risks.Visible = False
Me.Risk1.Visible = False
Me.RiskText.Visible = False
Me.Risk1text.Visible = False
Me.RiskButton.Visible = False

ElseIf Me.Check77 = True Then

Me.Risks.Visible = True
Me.Risk1.Visible = True
Me.RiskText.Visible = True
Me.Risk1text.Visible = True
Me.RiskButton.Visible = True

End If



Into the private sub 'form current'
Was This Post Helpful? 0
  • +
  • -

#3 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 211
  • View blog
  • Posts: 1,249
  • Joined: 26-March 09

Re: Still visible/nonvisible on next member ?

Posted 24 January 2012 - 08:58 AM

Have you tried using the checkbox value and constants (vbChecked/vbUnchecked)?

if chkTest.Value = vbchecked Then
etc.

This post has been edited by maj3091: 24 January 2012 - 08:59 AM

Was This Post Helpful? 0
  • +
  • -

#4 BobRodes  Icon User is online

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 323
  • View blog
  • Posts: 1,950
  • Joined: 19-May 09

Re: Still visible/nonvisible on next member ?

Posted 24 January 2012 - 04:33 PM

You're going to run into trouble with using true and false with a check box as maj points out. The reason for this is that check boxes can also be Greyed, as you will recall if you think about it. Now, you don't mention what your controls actually are in your code, but I think that check77 is your check box. I also suspect that by "next page" you really mean "next form." If so, "Me" refers to the form you're on. Otherwise, you put in the form name. So if you substitute the form name for me you might have more luck.
Was This Post Helpful? 0
  • +
  • -

#5 oMADMANo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 21-January 12

Re: Still visible/nonvisible on next member ?

Posted 25 January 2012 - 12:58 AM

You are correct in saying check77 is my check box but it wont be Grayed as i have set a control source for yes/no. The problem I am having is I am not actually changing forms only records within a form using accesses built in tool bar to change from member to member.
Was This Post Helpful? 0
  • +
  • -

#6 oMADMANo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 21-January 12

Re: Still visible/nonvisible on next member ?

Posted 25 January 2012 - 01:51 AM

Okay im trying something like this
Private Sub Form_Current()

Dim MemberId As Variant

    MemberId = DLookup("Value", "Membership_Database", "[Variable] = 'Member_NumberCurent'")

If Check77.Value = vbunchecked Then

MemberId.Risks.Visible = False
MemberId.Risk1.Visible = False
MemberId.RiskText.Visible = False
MemberId.Risk1text.Visible = False
MemberId.RiskButton.Visible = False

ElseIf Check77.Value = vbchecked Then

MemberId.Risks.Visible = True
MemberId.Risk1.Visible = True
MemberId.RiskText.Visible = True
MemberId.Risk1text.Visible = True
MemberId.RiskButton.Visible = True

End If




It doesn't work but that is the sort of thing I am looking to do.

Sorry I don't know how to edit post.
Member_Number is the primary auto defined number in my Member_Database.
Was This Post Helpful? 0
  • +
  • -

#7 BobRodes  Icon User is online

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 323
  • View blog
  • Posts: 1,950
  • Joined: 19-May 09

Re: Still visible/nonvisible on next member ?

Posted 25 January 2012 - 07:17 AM

You can't explain what you are trying to accomplish by showing the code that doesn't work. You haven't defined what "working" is!!

Suppose I said to you "I'm trying to get somewhere in this area. Here's a map. While it doesn't get me to the area, it's the sort of place I'm trying to get to. Can you tell me how to get to where I'm going?"

That would pretty much leave you as much in the dark about where I wanted to go as I am from your explanations. So, take a step back, put yourself in our place, and rewrite the last paragraph of your first post in such a way that your problem is intelligible to persons other than yourself. :)
Was This Post Helpful? 0
  • +
  • -

#8 oMADMANo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 21-January 12

Re: Still visible/nonvisible on next member ?

Posted 25 January 2012 - 10:24 AM

Sorry. The bit that works is the on click part where I click the tick box and it loads the code fine.
The problem I am having is that if I select my tick box even though the next record is not selected the items are still visible on the next page.
I would like it set up so that it only applies if that records tick box is or isn't checked.
Was This Post Helpful? 0
  • +
  • -

#9 Toadill  Icon User is online

  • D.I.C Regular
  • member icon

Reputation: 34
  • View blog
  • Posts: 274
  • Joined: 08-January 12

Re: Still visible/nonvisible on next member ?

Posted 25 January 2012 - 10:45 AM

View PostoMADMANo, on 25 January 2012 - 12:24 PM, said:

Sorry. The bit that works is the on click part where I click the tick box and it loads the code fine.
The problem I am having is that if I select my tick box even though the next record is not selected the items are still visible on the next page.
I would like it set up so that it only applies if that records tick box is or isn't checked.



I agree you still need to include more information please name all controls you are using such as textBox, TabControl, optionButtons, GroupBox,
Also when you say page do you mean form because if you do the proper syntax like said above is like this
form2.Risks.visible = false


//not sure what these are for but they must be a control of some sort.
Me.Risks.Visible = False
Me.Risk1.Visible = False




We need more information a screen shot would help.. just a suggestion :/
Was This Post Helpful? 0
  • +
  • -

#10 Toadill  Icon User is online

  • D.I.C Regular
  • member icon

Reputation: 34
  • View blog
  • Posts: 274
  • Joined: 08-January 12

Re: Still visible/nonvisible on next member ?

Posted 25 January 2012 - 10:57 AM

I would also like to add that naming conventions in VB6.0 help a lot to identify variables and controls later when using or presenting code.

Example

'Variable naming conventions
'In other words the standard way to program is to use abbreviations at 'the being of the code especially if you are just learning. 
dim strFile as string
dim intFile as integer
dim lngFile as long

'.......
'property values naming conventions 
'combo box
cmbScores
'text box
txtGetDirectory
'command button
cmdStartGame
'picture box
picAnimate



:hammer:
Was This Post Helpful? 0
  • +
  • -

#11 oMADMANo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 21-January 12

Re: Still visible/nonvisible on next member ?

Posted 27 January 2012 - 05:36 AM

Okay il start from the top. I have a database made in access with a form called "Membership" and a tick box "Riskassessment" using the control source "Riskassessment" from the table "Membership_Database" set up to a yes/no option. Im attempting to have my code only change the current record and display the text boxes and buttons I have made
called "Risk" (label) , "Risk1" (label) , " Risktext" (text box) , "Risk1text" (text box) , "RiskButton" (button).

Posted Image

The problem I am having is when I select the tick box it displays the items on all records.
I have tried this
Private Sub RiskAssesment_Click()


If RiskAssesment = False Then

Membership.CurrentRecord.Risk.Visible = False
Membership.CurrentRecord.Risk1.Visible = False
Membership.CurrentRecord.RiskText.Visible = False
Membership.CurrentRecord.Risk1text.Visible = False
Membership.CurrentRecord.RiskButton.Visible = False

ElseIf RiskAssesment = True Then

Membership.CurrentRecord.Risk.Visible = True
Membership.CurrentRecord.Risk1.Visible = True
Membership.CurrentRecord.RiskText.Visible = True
Membership.CurrentRecord.Risk1text.Visible = True
Membership.CurrentRecord.RiskButton.Visible = True

End If

End Sub


Private Sub Form_Current()

    
If Membership.CurentRecord.RiskAssessment = False Then

Membership.CurentRecord.Risks.Visible = False
Membership.CurentRecord.Risk1.Visible = False
Membership.CurentRecord.RiskText.Visible = False
Membership.CurentRecord.Risk1text.Visible = False
Membership.CurentRecord.RiskButton.Visible = False

ElseIf Membership.Recordset.RiskAssessment = True Then

Membership.CurentRecord.Risks.Visible = True
Membership.CurentRecord.Risk1.Visible = True
Membership.CurentRecord.RiskText.Visible = True
Membership.CurentRecord.Risk1text.Visible = True
Membership.CurentRecord.RiskButton.Visible = True

End If

End Sub



But I get the run time error '424' saying object required.
Was This Post Helpful? 0
  • +
  • -

#12 oMADMANo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 21-January 12

Re: Still visible/nonvisible on next member ?

Posted 27 January 2012 - 06:22 AM

The tick box works with
If Me.RiskAssesment = False Then


Me.Risk.Visible = False


but it updates the full form and not just current record
Was This Post Helpful? 0
  • +
  • -

#13 oMADMANo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 21-January 12

Re: Still visible/nonvisible on next member ?

Posted 28 January 2012 - 04:52 AM

Bump! please help still stuck.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1