473,698 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

12 New Member
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 1041
ADezii
8,834 Recognized Expert Expert
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
2935
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 "Access 2000 File Format". 1. Why did this happen? 2. Should I delete this database and start again? 3. I am not exactly sure what level of software the end user will be at (I am creating this database for use by someone else), but I have been...
3
15421
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. So I have to work in Access 2003 to do this. The problem is that the database that is created by my program will have to be imported into an application that only handles Access 97 .mdb file formats. I am wondering if there is any way to do this....
5
1811
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 thanks, Dean...
2
2335
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 open it in the new 97 database: "Microsoft Access has encountered a problem and needs to close. We are sorry for the inconvenience. If you were in the middle of something, the information you were
0
2332
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 after reinstalling Win XP, we used Office/Access 2003. When we try to process CC's we get a debug screen and Access itself crashes. However, the code still runs fine on Access/Office XP. The debug screen says: Method 'doSSLPost' of object...
18
19489
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, right after the release of 2007, I had problems with the installation dialog running every time I switched versions. Along with file association issues. I was hoping to find a work around to this, assuming that 8+ months later there would be a...
2
3516
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 - I can't find much info on this... - Can someone explain what's happening and how to fix this? Private Sub Form_Load() '2008-01-11 Dim rsx As ADODB.Recordset Set rsx = New ADODB.Recordset rsx.CursorLocation = adUseClient
12
4196
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 in the code as the docmd.gotorecord,,acnext moves down the records. But it does in ver 2003. Any Suggestions? Example of Table displayed in a continous form with 5 records. 1 1 1
5
13088
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 created a Blank 2007 DB and imported all the table , Queries , Forms Reports and Macros from the previous version. Although I can see all - The switchboard which is suppose to open immediately only opens with No information. I can only see my...
6
1912
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
8674
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9157
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9026
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2328
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.