By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,164 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,164 IT Pros & Developers. It's quick & easy.

Unknown Problem from a beginner

P: 12
In my database, I want to let it calculate some equations when I press a button. However when I do press the button, it states "Compile error: Method or data member not found". It highlights "Private Sub Command49_Click()" in yellow and ".P1Score" in blue. What does this mean?
The problem only arised when I added the section of P1 to P10 on. It was working fine before with just the S1 to S5. Does this mean that I don't have an object named P1Score while I have an object for S1Score? How do I find out what is S1Score in design view? Is there a find option or something?
I know that when I type "Me." it shows up a list and it is S1Score to S5Score but no PxScore. How do I fix this?
Is it something to do with AccessField? If so, what is it and how do I set P1Score as an accessfield?
Thank you in advance for your help and assistance! I've attached the code below. If you need more info to answer this question, please inform me. Thank you!

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command49_Click()
  2.  
  3.     answered = checkAllAnswered()
  4.  
  5.     If answered = False Then
  6.         Exit Sub
  7.     End If
  8.  
  9.     S1 = IIf(IsNull(Me.S1Score) Or Me.S1Score = 0, 1, CInt(Me.S1Score))
  10.     S2 = IIf(IsNull(Me.S2Score) Or Me.S2Score = 0, 1, CInt(Me.S2Score))
  11.     S3 = IIf(IsNull(Me.S3Score) Or Me.S3Score = 0, 1, CInt(Me.S3Score))
  12.     S4 = IIf(IsNull(Me.S4Score) Or Me.S4Score = 0, 1, CInt(Me.S4Score))
  13.     S5 = IIf(IsNull(Me.S5Score) Or Me.S5Score = 0, 1, CInt(Me.S5Score))
  14.     P1 = IIf(IsNull(Me.P1Score) Or Me.P1Score = 0, 1, CInt(Me.P1Score))
  15.     P2 = IIf(IsNull(Me.P2Score) Or Me.P2Score = 0, 1, CInt(Me.P2Score))
  16.     P3 = IIf(IsNull(Me.P3Score) Or Me.P3Score = 0, 1, CInt(Me.P3Score))
  17.     P4 = IIf(IsNull(Me.P4Score) Or Me.P4Score = 0, 1, CInt(Me.P4Score))
  18.     P5 = IIf(IsNull(Me.P5Score) Or Me.P5Score = 0, 1, CInt(Me.P5Score))
  19.     P6 = IIf(IsNull(Me.P6Score) Or Me.P6Score = 0, 1, CInt(Me.P6Score))
  20.     P7 = IIf(IsNull(Me.P7Score) Or Me.P7Score = 0, 1, CInt(Me.P7Score))
  21.     P8 = IIf(IsNull(Me.P8Score) Or Me.P8Score = 0, 1, CInt(Me.P8Score))
  22.     P9 = IIf(IsNull(Me.P9Score) Or Me.P9Score = 0, 1, CInt(Me.P9Score))
  23.     P10 = IIf(IsNull(Me.P10Score) Or Me.P10Score = 0, 1, CInt(Me.P10Score))
Dec 7 '07 #1
Share this Question
Share on Google+
5 Replies


JustJim
Expert 100+
P: 407
In my database, I want to let it calculate some equations when I press a button. However when I do press the button, it states "Compile error: Method or data member not found". It highlights "Private Sub Command49_Click()" in yellow and ".P1Score" in blue. What does this mean?
The problem only arised when I added the section of P1 to P10 on. It was working fine before with just the S1 to S5. Does this mean that I don't have an object named P1Score while I have an object for S1Score? How do I find out what is S1Score in design view? Is there a find option or something?
I know that when I type "Me." it shows up a list and it is S1Score to S5Score but no PxScore. How do I fix this?
Is it something to do with AccessField? If so, what is it and how do I set P1Score as an accessfield?
Thank you in advance for your help and assistance! I've attached the code below. If you need more info to answer this question, please inform me. Thank you!
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command49_Click()
  2.  
  3.     answered = checkAllAnswered()
  4.  
  5.     If answered = False Then
  6.         Exit Sub
  7.     End If
  8.  
  9.     S1 = IIf(IsNull(Me.S1Score) Or Me.S1Score = 0, 1, CInt(Me.S1Score))
  10.     S2 = IIf(IsNull(Me.S2Score) Or Me.S2Score = 0, 1, CInt(Me.S2Score))
  11.     S3 = IIf(IsNull(Me.S3Score) Or Me.S3Score = 0, 1, CInt(Me.S3Score))
  12.     S4 = IIf(IsNull(Me.S4Score) Or Me.S4Score = 0, 1, CInt(Me.S4Score))
  13.     S5 = IIf(IsNull(Me.S5Score) Or Me.S5Score = 0, 1, CInt(Me.S5Score))
  14.     P1 = IIf(IsNull(Me.P1Score) Or Me.P1Score = 0, 1, CInt(Me.P1Score))
  15.     P2 = IIf(IsNull(Me.P2Score) Or Me.P2Score = 0, 1, CInt(Me.P2Score))
  16.     P3 = IIf(IsNull(Me.P3Score) Or Me.P3Score = 0, 1, CInt(Me.P3Score))
  17.     P4 = IIf(IsNull(Me.P4Score) Or Me.P4Score = 0, 1, CInt(Me.P4Score))
  18.     P5 = IIf(IsNull(Me.P5Score) Or Me.P5Score = 0, 1, CInt(Me.P5Score))
  19.     P6 = IIf(IsNull(Me.P6Score) Or Me.P6Score = 0, 1, CInt(Me.P6Score))
  20.     P7 = IIf(IsNull(Me.P7Score) Or Me.P7Score = 0, 1, CInt(Me.P7Score))
  21.     P8 = IIf(IsNull(Me.P8Score) Or Me.P8Score = 0, 1, CInt(Me.P8Score))
  22.     P9 = IIf(IsNull(Me.P9Score) Or Me.P9Score = 0, 1, CInt(Me.P9Score))
  23.     P10 = IIf(IsNull(Me.P10Score) Or Me.P10Score = 0, 1, CInt(Me.P10Score))
Hi,
It seems to me that you must have controls on your form (the one where Command49 is) has controls called S1Score etc but there is no controls called PxScore. It may be that they are called TextPxScore or some other default Access name. You have two choices, change the code to match the control names or change the control names to match the code.

Jim

ps. A thread title more indicitave of your problem would help!
JJ
Dec 7 '07 #2

P: 12
Hi,
It seems to me that you must have controls on your form (the one where Command49 is) has controls called S1Score etc but there is no controls called PxScore. It may be that they are called TextPxScore or some other default Access name. You have two choices, change the code to match the control names or change the control names to match the code.

Jim

ps. A thread title more indicitave of your problem would help!
JJ
Is a control an object that you put on in design view? if so, I don't know where S1Score control is.... I'm trying to extend an existing database so I don't actually know what S1Score.
I have 5 tick boxes which are in a frame. And the control source is from a table with the column S1Score. I replicated this frame and changed the control source to P1Score. I also copied all the coding which is associated with S1Score and renamed it to be P1Score. Yet it still doesn't work. I don't know what the S1Score control is so therefore I can't make a P1Score control to replicate it. Is there a way to find the S1Score control in design view?

BTW, are controls the things which pop down in a list after you type the dot for "Me."?

I also looked into the object browser and search for S1Score. It came back that S1Score is a member to 5 different classes (all forms). I did the same for P1Score and it was only a member of 1 class. How do I add P1Score as a member for the other classes which S1Score is a member of?

I really have no clue in access so I have no idea what a control and things are. Sorry about the inconvience!

JJ, Thank you very much for you reply!

-HotKgon
Dec 7 '07 #3

JustJim
Expert 100+
P: 407
Is a control an object that you put on in design view? if so, I don't know where S1Score control is.... I'm trying to extend an existing database so I don't actually know what S1Score.
I have 5 tick boxes which are in a frame. And the control source is from a table with the column S1Score. I replicated this frame and changed the control source to P1Score. I also copied all the coding which is associated with S1Score and renamed it to be P1Score. Yet it still doesn't work. I don't know what the S1Score control is so therefore I can't make a P1Score control to replicate it. Is there a way to find the S1Score control in design view?

BTW, are controls the things which pop down in a list after you type the dot for "Me."?

I also looked into the object browser and search for S1Score. It came back that S1Score is a member to 5 different classes (all forms). I did the same for P1Score and it was only a member of 1 class. How do I add P1Score as a member for the other classes which S1Score is a member of?

I really have no clue in access so I have no idea what a control and things are. Sorry about the inconvience!

JJ, Thank you very much for you reply!

-HotKgon
Well HotKgon, you have been dropped in it right royally haven't you?

Make a copy of the database application using Windows Explorer so we don't break the first one. Not likely, but why take the risk, you should always work on a development version, not the working one.

You need to look at the table (in design view) which has S1Score in it. Try to figure out what (if any) are the differences in the SxScore fields. Then you need to add a new field for each PxScore (P1Score, P2Score etc) and save the table.

Now go to your form and, with the wizard button pressed on the toolbox, add an option group. See how you go from there. You might want to delete the original option group first and just add one with all the score fields in it at once.

Once you've got it working, either do it all again in the real application (good practice) or rename the table and form in the real application and import both the new table and new form from the development app.

Have fun and 'AveAGoodWeekend

Jim

ps after you type Me. you get offerred the whole gamut of things from Methods, Objects, Properties. This will include controls on your form and is a very, very good reson for adopting a naming convention such as prefixing all text boxes with txt so that they group together when you are in this list.
Dec 7 '07 #4

P: 12
thank you once again JJ. I found out that if I click on "add existing fields", put PxScore and made it invisible. It ends up working!
Dec 8 '07 #5

JustJim
Expert 100+
P: 407
thank you once again JJ. I found out that if I click on "add existing fields", put PxScore and made it invisible. It ends up working!
Good one.

Jim




(message too short my armpit!)
Dec 9 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.