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

Runtime error: could not find file

okay, so i am designing a login system which is connected to a preset database i made in ms access. here's the code that i have written:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmd_ok_Click()
  2.  
  3.     'Declare variables
  4.     Dim db As DAO.Database
  5.     '= DBEngine.OpenDatabase(DbFile, False, False)
  6.     Dim rs As Recordset
  7.     Dim WS As Workspace
  8.  
  9.     'Set workspace,database and recordset
  10.     Set WS = DBEngine.Workspaces(0)
  11.         DbFile = App.Path & ("\sample database 2000.mdb")
  12.     Set db = DBEngine.OpenDatabase(DbFile, False, False)
  13.     Set rs = db.OpenRecordset("Login", dbOpenTable)
  14.  
  15.     'To compare data in textboxes with that in database
  16.     If txt_password.Text = rs("Password") And txt_IDnum = rs("ID Number") Then
  17.  
  18.         'Show main menu form
  19.         frm_mainmenu.Show
  20.         Unload Me
  21.  
  22.     Else
  23.         'Display message box
  24.         MsgBox "Wrong Username and/or Password!", vbCritical, "Warning"
  25.  
  26.     End If
  27.  
  28. End Sub

there is a run time error which says that it could not find the file of my database. when debug, the line:

Set db = DBEngine.OpenDatabase(DbFile, False, False)

seems to be the problem. what should i do?
Oct 2 '11 #1
0 1399

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

Similar topics

2
by: Dhruv | last post by:
I was wondering if anyone could compile this code for me on VC. The problem that I've run into is that VC++6 does not support templates fully, and so, I cannot get this to compile, which relies...
21
by: Jenski182 | last post by:
Is this from a good coder? or a rubbish one? Whichever way, it was paid for his services, just want to know if its worth while.... Thanks Jen x #include <iostream.h> #include <conio.h>
23
by: James Aguilar | last post by:
Someone showed me something today that I didn't understand. This doesn't seem like it should be valid C++. Specifically, I don't understand how the commas are accepted after the function...
6
by: Niklaus | last post by:
Hi, Can someone point out what is wrong with this code ? How can i make it better optimize it. When run it gives me seg fault in linux. But windows it works fine(runs for a long time). Do we...
4
by: Harry Hudini | last post by:
Hi, I need to run exactly this code in an asp.net file when someone uploads an image, but i dont know C# and im having real issues converting it. If anyone can, could you convert it to VB.net...
12
by: Martin Ho | last post by:
This is the code I have so far, to generate 50.000 random numbers. This code will generate the same sequence every time I run it. But the problem being is that it's slow. It take on my p4 1.6gh...
11
by: Steve | last post by:
I'm hoping someone can help me out. I'm a newbie to vb.net still. I'm trying to convert the code below from VB6 to VB.NET. I'm not sure of the best way to go. This is basically a simple...
2
by: Ravi | last post by:
Can someone provide Code for vCARD Parser in C language ? I am in the need for vCard Parser which i can integarte on VC++ environment. Thanks in advance Ravindra Singhai
0
by: Badino | last post by:
Hi, Can someone tell me what to put in this code so that if a user selects 0 (Black) then make the font white (0) as my default colour is black on my Excel spreadsheet. Private Type...
1
by: simply | last post by:
hi i'm new member can someone help me with this code is for create a class car is creating a class car that has 3 private properties make , model , elapsedmileage as string the car class is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.