473,513 Members | 2,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access form not opening

46 New Member
I recently changed my code from Dlookup to opening a recordset. This is my first time using a record set and having issues opening the form now. When I click to open the form nothing happens. No errors and it doesn't load

Here is the opening code

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. Dim db As DAO.Database
  3. Dim rst As DAO.Recordset
  4. Dim strRst As String
  5. Dim strCriteria As String
  6.  
  7. strCriteria = "Employee='" & Forms![Royal time Stamp]![Driver] & "' And [Date]=#" & Date & "# And [Trip Sign Off]=0"
  8.  
  9. Set db = CurrentDb
  10. strRst = "SELECT [Punch ID] " & _
  11.          "FROM [Copy of Employee Work Statistics1] " & strCriteria
  12. Set rst = db.OpenRecordset(strRst, dbOpenDynaset)
  13.  
  14. [Punch ID] = rst![Punch ID]
  15. [Type of Work] = rst![Type of Work]
  16. If [Type of Work] = "" Then
  17. Else
  18. Me.[Type of Work].Locked = True
  19. [Trip_S_on] = rst![Trip Sign On]
  20. If [Type of Work] = "Transportation Specialist" Then
  21. Me.[bus number].Visible = True
  22. [bus number] = rst![bus number]
  23. Me.[bus number].Locked = True
  24.  
  25. Me.Route.Visible = True
  26. [Route] = rst![Route]
  27. Me.Route.Locked = True
  28. Else
  29. Me.Route.Locked = False
  30. Me.School.Locked = False
  31. Me.[bus number].Locked = False
  32. End If
  33. If [Route] = "field Trip" Then
  34. Me.[School].Visible = True
  35. [School] = rst!School
  36. Me.School.Locked = True
  37. Else
  38. Me.School.Locked = False
  39. End If
  40. End If
  41.  
  42.  
  43. 'At the end of your code, close what you open
  44. 'and release what you set
  45. rst.Close
  46. Set db = Nothing
  47. Set rst = Nothing
  48.  
  49.  
  50. End Sub
Thanks for your help,
Vasago
Apr 7 '14 #1
5 1601
Seth Schrock
2,965 Recognized Expert Specialist
Are you trying to open the form from the navigation pane, or from a button that you created?
Apr 7 '14 #2
Vasago
46 New Member
Running into the same issue if I use my created button or navigation pane to open.
Apr 7 '14 #3
zmbd
5,501 Recognized Expert Moderator Expert
Place a STOP at line6 of the code.
Execute/Open the form
You should go into debug mode at this point in your code.
[F8] to step your code until you either find the error or the line the form closes on.


And [Date]=#"
petpeeve:
-alphanumeric this is very importaint to keep in mind when nameing fields, alphanumeric and preferably no spaces just underscores:
Access 2007 reserved words and symbols
AllenBrowne- Problem names and reserved words in Access


(petPeeves are nummmy; however, they get tough and stringy if you let them grow too big! (^_^) )
Apr 7 '14 #4
Vasago
46 New Member
Thank you for your help. I tried all of the above with no luck. Load a backed-up version and haven't had a problem since
Apr 8 '14 #5
zmbd
5,501 Recognized Expert Moderator Expert
I can't count the number of times a backup has been the life saver. Hence my mantra to Backup, never work on the production version, never work on the only copy of the development version - always a copy.

You could try the compact/repair on the original; however, that maybe a moot-point (^_^)
Apr 8 '14 #6

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

Similar topics

2
11672
by: Josh Strickland | last post by:
I am attempting to create an Access database which uses forms to enter data. The issue I am having is returning the query results from the Stored Procedure back in to the Access Form. ...
2
323
by: Tony Schoeffler | last post by:
I have an Access application where it would desirable to open a word file directly from an Access Form. I have been able to open the Word application, but I have not been able to have it open with...
1
2018
by: SortaNortth | last post by:
Is it possible to code to a VB.NET windows form button to open a Microsoft Access Form? If so, which namespace(s)/class(es) would I use in doing the coding? Are there any good reference books...
1
9739
by: kevcar40 | last post by:
hi is it possible to stop a form opening if the result of the query is null? eg select a company name from a combobox if the name is not in the table (ie the query returns null) can i stop...
4
1961
by: Shailja | last post by:
Hi, Can anyone tell me how to open an access form from VB when access database is closed? Form gets open when database is open but I want code to open access form when database is closed?
1
4262
by: jtertin | last post by:
I am currently using the following code to make sure a file is writable (i.e. is not in use) by using the CanWrite method of the FileStream object. Using the code below, the TextWriter is still...
1
1701
by: make1circle | last post by:
Hi all, It's a novice question and hopefully someone could help me out. I've designed an access form for entering patient information. Right now it needs to be modified in the way that the...
4
1986
by: rwm | last post by:
Hi Before updating to Access 2007 we could open outlook contact entries by using a hyperllink along the lines of <outlook://contacts etc> This does not seem to work in 2007 any more. We have a...
0
1075
by: Nigel Wallace | last post by:
Hi, Currently I have access 2003 opening a pre-formatted email for the user to make final amendments to or just send. Can any one tell me how I would go about getting access to open a custom form...
1
1428
by: nuwan1988 | last post by:
in the printing of the access form using following cord.. get error........ Private Sub CommandBtn_Click() Dim MyForm As Form Set MyForm = Screen.ActiveForm DoCmd.SelectObject acForm,...
0
7157
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...
0
7535
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...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7521
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5682
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5084
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...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1591
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 ...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.