473,387 Members | 1,528 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,387 software developers and data experts.

Part 2: Macros/VBA created in Access 2003 not working in Access 2013

12
ADezii and zmbd,

I have one other question. There seems to be some other code which possibly should reflect the new DAO code. the following does not allow forms to open any longer and files were not moved. I believe the issue is showing the additional string path and view

Expand|Select|Wrap|Line Numbers
  1.  
  2.     Private Sub cmdDETAIL_Click()
  3. If IsNull([prmEmpNo]) Then
  4.     MsgBox ("No employee selected.")
  5.     [prmEmpNo].SetFocus
  6.     Exit Sub
  7. End If
  8. ProjectCount = NoOfProjects
  9. If ProjectCount <> 0 Then
  10.     Forms![fPREPROJECT]![fProjectData].SetFocus
  11.     ProjectCount = NoOfProjects
  12. Else
  13.     MsgBox ("Selection has no records.")
  14.     Exit Sub
  15. End If
  16. Select Case prmProjectGroup
  17.     Case "Complaints"
  18.         If ProjectCount <> 0 Then DoCmd.OpenForm "fComplain01", acNormal, , , acFormEdit
  19.     Case "Lab"
  20.         If ProjectCount <> 0 Then DoCmd.OpenForm "fComplain01", acNormal, , , acFormEdit
  21.     Case "ASBESTOS-INSP"
  22.         If ProjectCount <> 0 Then DoCmd.OpenForm "fAsbInsp01", acNormal, , , acFormEdit
  23.     Case "Inspect-PERM"
  24.         If ProjectCount <> 0 Then DoCmd.OpenForm "fFacInsp01", acNormal, , , acFormEdit
  25.     Case "Enforcement Cases"
  26.         If ProjectCount <> 0 Then DoCmd.OpenForm "fEnforce01", acNormal, , , acFormEdit
  27.     Case "Projects"
  28.         If ProjectCount <> 0 Then DoCmd.OpenForm "fProject01", acNormal, , , acFormEdit
  29.     Case "Permits"
  30.         If ProjectCount <> 0 Then DoCmd.OpenForm "fPermRev01", acNormal, , , acFormEdit
  31.     Case "Training"
  32.         If ProjectCount <> 0 Then DoCmd.OpenForm "fTraining01", acNormal, , , acFormEdit
  33.     Case Else
  34.         MsgBox ("Type of Project selected does not have detail records.")
  35.         Exit Sub
  36. End Select
  37. End Sub
  38.  
  39. Private Sub cmdExit_Click()
  40. DoCmd.Echo False
  41. Me.Visible = False
  42. If (SysCmd(acSysCmdGetObjectState, A_FORM, "fAQSplashForm") = 0) Then
  43.   DoCmd.OpenForm "fAQSplashForm"
  44. End If
  45. DoCmd.Echo True
  46. End Sub
  47.  
  48. Private Sub cmdHELP_Click()
  49. Call NavigHelp
  50. End Sub
  51.  
  52.  
  53. Private Sub cmdMemo_Click()
  54.  
  55. If [Forms]![fPREPROJECT]![fProjectData].Form.CurrentRecord <> 0 Then
  56.     glbProjID = [Forms]![fPREPROJECT]![fProjectData].Form![ipProjID]
  57.     [Forms]![fPREPROJECT]![FormLink1] = [Forms]![fPREPROJECT]![fProjectData].Form![ipProjID]
  58.     DoCmd.OpenForm "fProjMemoPopup"
  59. End If
  60.  
  61.  
  62. End Sub
  63.  
  64.  
  65.  
  66. Private Sub Form_Activate()
  67. 'Me![fProjectData].SetFocus
  68. 'Me![fProjectData].Form![ipProjID].SetFocus
  69.  '           .SelStart = intWhere - 1
  70. '            .SelLength = Len(strSearch
  71. End Sub
  72.  
  73. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  74. If KeyCode <> vbKeyF6 Then Exit Sub
  75. KeyCode = 0
  76. If (SysCmd(acSysCmdGetObjectState, A_FORM, "fAsbFac01") <> 0) Then
  77.     Forms![fAsbFac01].SetFocus
  78. ElseIf (SysCmd(acSysCmdGetObjectState, A_FORM, "fFacDetail01") <> 0) Then
  79.     Forms![fFacDetail01].SetFocus
  80. End If
  81.  
  82. End Sub
  83.  
  84. Private Sub Form_Open(Cancel As Integer)
  85. Dim db As DAO.Database
  86. Set db = CurrentDb()
  87. 'load the Rowsource for [prmEmpNo]
  88. 'code below performs a query and loads information
  89. 'from the EMPLOYEE table into the Rowsource
  90. Dim EmpInfo As DAO.Recordset
  91. Dim i As Integer
  92. Dim qte
  93. qte = Chr(34)
  94. Dim prm As Parameter
  95. Dim QD As DAO.QueryDef
  96.     Set QD = db.QueryDefs("qCmbEmpInfo2")
  97. For i = 0 To QD.Parameters.Count - 1
  98.     Set prm = QD.Parameters(i)
  99.     prm.Value = Eval(prm.Name)
  100. Next i
  101. Set EmpInfo = QD.OpenRecordset(dbOpenDynaset)
  102. EmpInfo.MoveFirst
  103. Do Until EmpInfo.EOF
  104.     [prmEmpNo].RowSource = [prmEmpNo].RowSource & qte & EmpInfo![EmpInfo] & qte & ";" & qte & EmpInfo![Empl_No] & qte & ";"
  105. EmpInfo.MoveNext
  106. Loop
  107. EmpInfo.Close
  108. 'this adds an additional entriy at the beginning of Rowsource
  109. [prmEmpNo].RowSource = qte & "AllActive" & qte & ";" & qte & "Actv" & qte & ";" & [prmEmpNo].RowSource
  110. 'this adds additional entries to the end of Rowsource
  111. [prmEmpNo].RowSource = [prmEmpNo].RowSource & qte & "TOXICS" & qte & ";" & qte & "tox" & qte & ";"
  112. [prmEmpNo].RowSource = [prmEmpNo].RowSource & qte & "STATIONARY SOURCE" & qte & ";" & qte & "cmp" & qte & ";"
  113. [prmEmpNo].RowSource = [prmEmpNo].RowSource & qte & "AllEmployees" & qte & ";" & qte & "AllEmployees" & qte & ";"
  114. 'sets values of startup parameter fields
  115. Forms![fPREPROJECT]![prmProjectGroup] = "AllProjects"
  116. Forms![fPREPROJECT]![prmOpenClosed] = 2
  117. Forms![fPREPROJECT]![prmEmpNo] = "Actv"
  118. DoCmd.Maximize
  119. Me![fProjectData].SetFocus
  120.  
  121. End Sub
  122.  
  123.  
  124.  
  125. Private Sub grpOpenClosed_Click()
  126. Call ResetParms
  127. End Sub
  128.  
  129.  
  130.  
  131. Public Function NoOfProjects()
  132. NoOfProjects = DCount("*", "qProjectData")
  133. End Function
  134.  
  135. Private Sub Opt1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  136. Call RedoSort(1)
  137. 'ME: added September 10, 2008
  138. Call RedoSort(1)
  139.  
  140. End Sub
  141.  
  142. Private Function RedoSort(OptNo As Integer)
  143. If Me.[grpOpenClosed] = OptNo Then
  144.     Forms![fPREPROJECT]![fProjectData].Form.OrderBy = "[SortDate],  [Due Date], [Project Description]"
  145. End If
  146. 'ME:  09/03/2008:  added the following for the Plan Date sorting-this is a test
  147. If OptNo = 5 Then
  148.     Forms![fPREPROJECT]![fProjectData].Form.OrderBy = "[SortDate], [Plan Date], [Project Description]"
  149. End If
  150. End Function
  151.  
  152. Private Sub Opt2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  153. Call RedoSort(2)
  154. 'ME: added September 10, 2008
  155. Call RedoSort(2)
  156. End Sub
  157.  
  158.  
  159.  
  160. Private Sub Opt3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  161. Call RedoSort(3)
  162. 'ME: added September 10, 2008
  163. Call RedoSort(3)
  164. End Sub
  165.  
  166.  
  167. Private Sub Opt4_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  168. Call RedoSort(4)
  169. 'ME: added September 10, 2008
  170. Call RedoSort(4)
  171. End Sub
  172.  
  173. Public Function ResetParms()
  174. Call qProjectDataGen(Forms![fPREPROJECT], Forms![fPREPROJECT]![fProjectData].Form)
  175. [Forms]![fPREPROJECT]![fProjectData].Requery
  176. If [Forms]![fPREPROJECT]![fProjectData].[Form].[CurrentRecord] <> 0 Then
  177.     Me![fProjectData].SetFocus
  178.     Me![fProjectData].Form![ipProjID].SetFocus
  179. End If
  180. End Function
  181.  
  182. Private Sub Opt5_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  183. Call RedoSort(5)
  184. 'ME: added September 10, 2008
  185. Call RedoSort(5)
  186. End Sub
  187.  
  188. Private Sub prmEmpNo_Click()
  189. Call ResetParms
  190.  
  191. End Sub
  192.  
  193. Private Sub prmProjectGroup_Click()
  194. Call ResetParms
  195.  
  196. End Sub
  197.  
  198.  
The OpenForm commands are in lines 16-37 of the code sent.

(Related thread: Macros/VBA created in Access 2003 not working in Access 2013 )
Sep 14 '16 #1
1 1030
ADezii
8,834 Expert 8TB
If prmProjectGroup is an Option Group, then Case Values for
Expand|Select|Wrap|Line Numbers
  1. Select Case prmProjectGroup 
will be Numeric and not Text.
Sep 14 '16 #2

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

Similar topics

3
by: Susan Bricker | last post by:
I just purchased a new PC that came with MS Office 2003 (Professional Ed.). I opened MS Access 2003 and created a new database but it opened with a "note in the window header bar" that says...
3
by: Dave | last post by:
Hi, I wrote a VBA program to read and process data from an ODBC source and put it into an Access database. I want to make the program into an MDE file and run it on systems with Access 2003. ...
5
by: DeanL | last post by:
I know you can convert a database from Access 2003 to 97 easily but is there anything that I should avoid doing in Access 2003 that might make my database incompatible with Access 97? Many...
2
by: carmela_wong | last post by:
Hi all, I have converted a database from Access 2003 to Access 97. Everything gets neatly imported into the new database except for one form which continues to show a fatal error when I try to...
0
by: jayohare | last post by:
Hello, I have code within my DB application to process credit cards through authorize.net. Ive been using the same code for several years without a problem. I have an order entry computer and...
18
by: Dennis | last post by:
Greetings. I want to run the two versions of Access on the same machine (2003 & 2007). I still need 2003 for most of my work, yet I need to start learning 2007. In my previous attempts at this,...
2
by: curran.george | last post by:
'add one textbox to form1 with Control Source property = ID 'copy/paste the form_load code below: 'Then open the form and then attempt to sort the datasheet 'crashes 2003, error 3450 Access 2007 -...
12
by: pballou | last post by:
The is a simple example of code that worked in access 2003 but does not in access 2007. I have checked it with the debugger and the reason is the value of formField1 does not change in ver. 2007...
5
by: SUSAN MALAN | last post by:
I have created a Database in Access 2003 and have now downloaded 2007. I have tried converting it in several ways. I have opened my previous Database and saved it as a 2007 verion -No success, I have...
6
by: msilva100 | last post by:
Hello, I need to have remote access to a MS Access 2013 Database running on a Windows 7 Server. Can someone kindly recommend a remote access tool? Thank you.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.