473,670 Members | 2,499 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 1610
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
11693
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. tCetecM1CUST (SQL Table that contains the Customer Information) tAccountingDetail (SQL Table that contains the information in the form) frmAccountingEntry (Access form used to enter data) spGetCustomerInformation (Stored Procedure which returns data using...
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 the desired file. Any help or sample code would be appreciated.
1
2027
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 that talk about opening application programs from within VB.NET? (or is this either not possible, in general, or just not a good idea?) Thanks for any info Dick Marcum
1
9766
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 the form opening thanks
4
1968
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
4270
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 trying to write to the file and is throwing an exception (File... in use by another process) whenever the output file (strFileName) is open. I am trying to prevent it from writing to it at all if this is the case... Any insight? Public...
1
1709
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 form users will first be shown a webpage-type front page that prompts the user to 1) enter new patient information 2) search patient with keywords or id, before accessing/modifying the actual database. Can anyone shed some lights on how to do so? ...
4
1995
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 linked table in the database which is drawing data from the outlook contact file and have related this to the relevant access tabel so we can see all the data from both tables in the access form but I am at a loss as to how to actually open the...
0
1082
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 from the organisational library say IPM.NOTE.FORM1 thanks Nigel
1
1437
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, MyForm.Name, True DoCmd.PrintOut DoCmd.SelectObject acForm, MyForm.Name, False End Sub
0
8466
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
8384
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
8901
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
8813
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...
0
8659
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6212
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
4208
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4388
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1791
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.