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

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

P: 3
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
Share this Question
Share on Google+
2 Replies


ADezii
Expert 5K+
P: 8,669
@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

P: 3
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

Post your reply

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