Hello all,
 
I'm new here to the community and before I start asking away I want to say hello to all, and hope that I can help out as much as I can.
 
beforehand, maybe I should inform that I actually am not familiar with VB and even less with access (I was a c# fan and usually went for Visual Studio or Eclipse if Java was used).
 
so if I make stupid VB mistakes, that's why
 
My question is about multiple queries.
at the moment whenever I collect data from the database I make a completely new connection, more or less like this:
	
	
	
		
 
This works great, easier almost then c#, however now comes my problem. Where in c# I would chase a new query to an already active connection. In VBA - Access, when I want to enter a new query I make a completely new connection. so the above code I repeated now 4 times in a tiny form. and I believe that can be done more efficient.
 
 
The reason why I need 4 queries in a tiny form has to do with my inexperience with VB (and SQL). for example, I need to make a list of all active asignments, and a list of all employees.
so I do a
	
	
	
		
and
	
	
	
		
Because when I combine them (SELECT Asignment.descrip, employees.name FROM asignments, employees) the list of employees is repeated 5 times
 
Cheers
 I'm new here to the community and before I start asking away I want to say hello to all, and hope that I can help out as much as I can.
beforehand, maybe I should inform that I actually am not familiar with VB and even less with access (I was a c# fan and usually went for Visual Studio or Eclipse if Java was used).
so if I make stupid VB mistakes, that's why
My question is about multiple queries.
at the moment whenever I collect data from the database I make a completely new connection, more or less like this:
		Code:
	
	
	    Dim conConnection As New ADODB.Connection
    Dim cmdCommand As New ADODB.Command
    Dim rstRecordSet As New ADODB.Recordset
    Dim check_01 As Boolean
 
    conConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\FILES\IT_DEV_MGMT.mdb;Mode=Read|Write"
    conConnection.CursorLocation = adUseClient
    conConnection.Open
 
    With cmdCommand
        .ActiveConnection = conConnection
        .CommandText = "SELECT * FROM Employees;"
        .CommandType = adCmdText
    End With
 
    With rstRecordSet
        .CursorType = adOpenStatic
        .CursorLocation = adUseClient
        .LockType = adLockOptimistic
        .Open cmdCommand
    End With
	This works great, easier almost then c#, however now comes my problem. Where in c# I would chase a new query to an already active connection. In VBA - Access, when I want to enter a new query I make a completely new connection. so the above code I repeated now 4 times in a tiny form. and I believe that can be done more efficient.
The reason why I need 4 queries in a tiny form has to do with my inexperience with VB (and SQL). for example, I need to make a list of all active asignments, and a list of all employees.
so I do a
		Code:
	
	
	SELECT *
FROM Asignments
	
		Code:
	
	
	SELECT *
FROM employees
	Cheers