473,785 Members | 2,819 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Having to open a db manually before i connect

84 New Member
ok ive set up a connection between my access db ( 97) and my vb6 interface and this is what i got

Expand|Select|Wrap|Line Numbers
  1. form_load
  2. Data6.DatabaseName = App.Path & "\cjmillers.mdb"
  3. Data6.RecordSource = "select * from Orders"
  4.  
  5.  
  6. '............................
  7. 'Counts how many order_ID's in the table Orders
  8. 'Orderidno is how many in the table
  9. 'Orderidlist = Orderidno -1
  10. With Data6
  11.  
  12.     .Refresh
  13.     .Recordset.MoveFirst
  14.     orderidno = DCount("[Order_ID]", "Orders")
  15.     Label17.Caption = orderidlist
  16.     orderidlist = orderidno - 1
  17.         Do Until .Recordset.EOF
  18.         For i = 0 To orderidlist
  19.         Combo3.List(i) = .Recordset.Fields(0)
  20.         .Recordset.MoveNext
  21.         Next i
  22.         Loop
  23. End With
  24. '............................
And a different form



Expand|Select|Wrap|Line Numbers
  1. Dataloginuser.DatabaseName = App.Path & "\login.mdb"
  2. Dataloginuser.RecordSource = "select * from user"
  3.  
  4.  
  5. '*********************************
  6. 'Fieldno = then number of [name] in the table "user"
  7. 'Field = the number of [name] in the table "user" minus 1
  8. '[name] in the table user in the db cjmillers.mdb
  9.  
  10. With Dataloginuser
  11.   .Refresh
  12.   .Recordset.MoveFirst
  13.   fieldno = DCount("[name]", "user")
  14.   Text6.Text = fieldno
  15.   Field = fieldno - 1
  16.     Do Until .Recordset.EOF
  17.         For i = 0 To Field
  18.         Combo1.List(i) = .Recordset.Fields(0)
  19.         'Combo1 user selection combobox
  20.         .Recordset.MoveNext
  21.         Next i
  22. Loop
  23. End With 

The only problem with this is that i have to manually open the database before i run my program with is annoying and i want to avoid. So can someone give me some hints or tips to fix this :(

i have a login db (called login.mdb) and a "main" db called cjmillers.mdb which hold all the order details etc.

when i login it works fine and i dont need to open the db manually but when i try and connect to the "main" db after i log in i have to open up the db or it comes up with a reserved error 2950.


Thanks in advance and i hope someone can help :D

P.s i think its something to do with the Dcount as that is whats highlighted on error
Oct 11 '07 #1
8 1689
debasisdas
8,127 Recognized Expert Expert
Are you trying to open the database while connection is established to the application.
Oct 11 '07 #2
metalheadstorm
84 New Member
i run my program, login, it goes to the main menu and in the main menu's form load it connects ( that code i posted before)
Oct 11 '07 #3
metalheadstorm
84 New Member
yes i have to open the db then run my program for it to connect propperly, i want it so u dont have to open the db before you run the program... so it connects when the program runs
Oct 11 '07 #4
debasisdas
8,127 Recognized Expert Expert
Kindly post the exact error message with error number.
Oct 11 '07 #5
metalheadstorm
84 New Member
Run-time error '2950':
Reserved error

when i click debugg the Dcount line is highlighted in yellow

P.s how you make the code text appear in colour ?
Oct 11 '07 #6
jrtox
89 New Member
yes i have to open the db then run my program for it to connect propperly, i want it so u dont have to open the db before you run the program... so it connects when the program runs

Hello,
You are using 2 DB, 1 for the Login and 1 for the main DB..
Anyway, Im not using that way.

I have here a sample connecting VB6 and DB, Follow the Link and
Study my attachment..

http://www.thescripts.com/forum/thread719352.html

Regards
Ervin
Oct 11 '07 #7
debasisdas
8,127 Recognized Expert Expert
P.s how you make the code text appear in colour ?
Use proper code tags in all your codes.
Oct 11 '07 #8
metalheadstorm
84 New Member
Use proper code tags in all your codes.
Thank you :P

............
Oct 11 '07 #9

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

Similar topics

1
2589
by: Anand | last post by:
Hi i am having trouble adding a recordset into the access database, the code seems to be working fine it passs and parses through all variables just fine without showing any errors and also when i access the recordset it displays the results, what the real issue is that the entry is not made into the database even though i use the Update command and i have also tried the BeginTrans and CommitTrans nothign seems to work and i am unable to...
6
1359
by: Curt Emich | last post by:
I get the following error when I write any code against a connection that is hooked to an Access database: The Microsoft Jet database engine cannot open the file 'C:\Inetpub\wwwroot\TimeTracker\Data\TimeTracker.mdb'. It is already opened exclusively by another user, or you need permission to view its data. Does anyone have any idea what to do about this?
30
7447
by: aka | last post by:
Hi I have a DB2 v8.1 on AIX and DB2 Connect EE on Solaris wich is connected to OS/390 DB2 subsystems via APPC / SNA. I have cataloged the DB2 Connect instance as tcpip node and then the Host DB cataloged on that node...this works from v7.2 Fixpack 11 clients and servers, but with v8.1 server I get SQL1334N. Does anyone has an idea? Thanks
2
2128
by: Jim | last post by:
Is it possible to have a Connection class that opens up connection to my DB and leaves it open until I decide to close it? I run many SQL statements so I was wondering if it's possible to call a Class1.GetProducts that sets up an SQL statement and then calls another Class2.Connect that actually opens up the connection Class2.Connect would not receive anything (since the connections string is always the same) and would not return anything....
6
8582
by: B B | last post by:
Okay, here is what's happening: I have a reasonably fast laptop (1.4 GHz Mobile M, so comparable to 2.5GHz P4) doing .net development. Running Windows XP pro, SP2 IIS is installed and running fine All SQL Servers I am referring to share a small (10 computers or so) LAN with a 100MB Switch. No other computers on the LAN exhibit this problem.
0
1039
by: Tim | last post by:
Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <u$xxJS#OEHA.3300@TK2MSFTNGP09.phx.gbl> Newsgroups: microsoft.public.dotnet.languages.vb NNTP-Posting-Host: dsl21.htonline.net 12.159.202.82 Lines: 1 Path:...
0
1220
by: Pavils Jurjans | last post by:
Hello, I have two questions regarding the Session state. 1) Is there some way on the server to programmatically access the other active sessions? Well, perhaps the question should be formulated not "is there a way", but "how to do it", because that almost inevitably must be possible - after all, the ASP.NET enables access for all the session users to their respective sessions. Perhaps studying the full request lifetime, and finding...
3
4533
by: blackpuppy | last post by:
I am just beginner on PHP. I am reading "Spring Into PHP 5" but cannot make the ftp examples work. I am running PHP scripts on a Fedora Core 5 (VMWare virtual machine) on top of a Windows XP Professional. The PHP version is 5.1.4. The PHP script is shown below. #! /usr/bin/php <?php $ftp_server = "myftpserver";
8
1411
by: hoetat | last post by:
When I try to open a connection to the database I hit an error "Object reference not set to an instance of an object." I have make a simple test connection function same error coming out when open connection as the line in 9 "connect.Open();". Here my function: private void butConnect_Click(object sender, System.EventArgs e) { SqlConnection connect = null; try {
0
9480
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
10324
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
10147
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
9949
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...
0
8971
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
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
5380
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...
1
4050
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
3
2879
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.