473,320 Members | 1,993 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Member already exists in an object module from which this object module derives

I ceated a automatic split form from a table called "Master NSN List." I then added 2 buttons "cmdShowHide" which toggles between showing and hiding the form section giving more room for the datasheet and "cmdFixNSN" which takes a portion of the NSN and puts it in another field then removes all of the dashes.

The form loads fine until i add code to either of the buttons or the form_load event then i get the message "Member already exists in an object module from which this object module derives"

I have tried to change the name of the form and the buttons, deleting the form and recreating it, building a query and basing the form off of it but nothing works.

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Const ShowSplit1 As Single = 5685, HideSplit1 As Single = 1500
  5. Const ShowTop1 As Single = 4320, HideTop1 As Single = 0
  6. Const FSCM As Integer = 4
  7. Dim NoFscm(1 To 2) As Integer, DashFscm(1 To 3) As Integer
  8. Dim intNSN As Integer, intCount As Integer
  9. Dim strNSN(1 To 2) As String, strFSCM As String
  10.  
  11. Private Function ShowHide(Show As Boolean) As Boolean
  12.     With [Form_Master NSN List]
  13.         .txtNSN.Visible = Show
  14.         .txtFSCM.Visible = Show
  15.         .txtEndItem.Visible = Show
  16.         .txtRemarks.Visible = Show
  17.         .txtCost.Visible = Show
  18.         .chkOnOrder.Visible = Show
  19.     End With
  20.  
  21.     If Show = True Then
  22.         With [Form_Master NSN List]
  23.             .SplitFormSize = ShowSplit1
  24.  
  25.             .cmdShowHide.Top = ShowTop1
  26.             .cmdShowHide.Caption = "Hide Details"
  27.         End With
  28.     Else
  29.         With [Form_Master NSN List]
  30.             .SplitFormSize = HideSplit1
  31.  
  32.             .cmdShowHide.Top = HideTop1
  33.             .cmdShowHide.Caption = "Show Details"
  34.         End With
  35.     End If
  36.  
  37.     ShowHide = Not Show
  38. End Function
  39.  
  40. Private Sub cmdFixNSN_Click()
  41.     'intNSN = Len(txtNSN.Value)
  42.     NoFscm(1) = 4
  43.     NoFscm(2) = 8
  44.     DashFscm(1) = 6
  45.     DashFscm(2) = 9
  46.     DashFscm(3) = 13
  47.     strNSN(1) = txtNSN.Value
  48.     intCount = [Form_Master NSN List].Count
  49.  
  50.     Select Case Len(strNSN(1))
  51.     Case 16
  52.         strFSCM = Left(strNSN(1), FSCM)
  53.         txtFSCM.Value = strFSCM
  54.         strNSN(2) = Mid(strNSN(1), DashFscm(1), 2)
  55.         strNSN(2) = strNSN(2) & Mid(strNSN(1), DashFscm(2), 3)
  56.         strNSN(2) = strNSN(2) & Mid(strNSN(1), DashFscm(3), 4)
  57.         txtNSN.Value = strNSN(2)
  58.     Case 11
  59.         strNSN(2) = Left(strNSN(1), 2)
  60.         strNSN(2) = strNSN(2) & Mid(strNSN(1), NoFscm(1), 3)
  61.         strNSN(2) = strNSN(2) & Mid(strNSN(1), NoFscm(2), 4)
  62.         txtNSN.Value = strNSN(2)
  63.     End Select
  64.  
  65.     DoCmd.GoToRecord , , acNext
  66. End Sub
  67.  
  68. Private Sub cmdShowHide_Click()
  69. Static blShow As Boolean, intCount As Integer
  70.     intCount = intCount + 1
  71.     If intCount = 1 Then
  72.         blShow = True
  73.     End If
  74.     blShow = ShowHide(blShow)
  75. End Sub
Nov 21 '09 #1
2 7238
ADezii
8,834 Expert 8TB
@jesus4gaveme03
It will be pretty hard to resolve this problem simply by looking at the code itself. Can you Upload a Copy of the Database? BTW, does your Project Name conflict with anything?
Nov 21 '09 #2
I found the problem

Const FSCM As Integer = 4

FSCM is the name of a field and the constant I defined
Nov 21 '09 #3

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

Similar topics

15
by: Wolfram Humann | last post by:
Hi, please don't be too harsh if I made stupid errors creating this simple example from my more complex case. Suppose I have a class like this: class BOOK { const string title;
11
by: Roger Leigh | last post by:
The C++ book I have to hand (Liberty and Horvath, Teach yourself C++ for Linux in 21 Days--I know there are better) states that "static member functions cannot access any non-static member...
8
by: Scott J. McCaughrin | last post by:
The following program compiles fine but elicits this message from the linker: "undefined reference to VarArray::funct" and thus fails. It seems to behave as if the static data-member:...
12
by: akiriwas | last post by:
The subject basically says what I am having trouble with. For an example lets say I have a class A which has a function f. I then also have a class B which inherits from A and has a function g. ...
7
by: ank | last post by:
Hi, I was curious about how to define static data member of template class. Should I put the definition in a separate source file or in the same header file as its template class? And when this...
5
by: Peter Olcott | last post by:
I created an object that requires access to another objects data, yet have found no good way to pass this data as a parameter because the member function that requires this data must be a binary...
2
by: hardieca | last post by:
Good morning, I am creating a CMS which I would like to support multiple DBs for its back-end. I have taken the approach of using DBProviderFactories to keep my code flexible enough so that I...
16
by: Fir5tSight | last post by:
Hi All, I have a small C#.NET program that is as follows: using System; class A { protected int x = 123; }
52
by: Ben Voigt [C++ MVP] | last post by:
I get C:\Programming\LTM\devtools\UselessJunkForDissassembly\Class1.cs(360,27): error CS0535: 'UselessJunkForDissassembly.InvocableInternals' does not implement interface member...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.