|
-
Mar 19th, 2007, 05:48 AM
#1
Thread Starter
Lively Member
[RESOLVED] msAccess
hi everyone
I'm new here and trust i can get helpful tips and precious support from u all.
I will try to hepl as far as I can too.
I am currently designing a db with msAccess. It's been some time since I last designed db's and programmed with VB - thus, numerous problems to solve!!
Well, I have one form which would not display any control at all on running it !!! ANyone know any property causing this?
I am also using a login form to the applic. Since I am using a table of users, I need to check user input against records in my table with:
Dim oRs As ADODB.Recordset
Dim sConn As String
Dim sSQL As String
sConn = "Provider='SQLOLEDB';Data Source='MySqlServer';" & _
"Initial Catalog='inforGT';Integrated Security='SSPI';"
Set oRs = New ADODB.Recordset
oRs.CursorLocation = adUseClient
oRs.Open "tblUsers", objConn, adOpenStatic, adLockOptimistic, adCmdTable
oRs.Find ("' & Username.text & '")
oRs.Find ("' & Password.text & '")
If oRs.EOF Then
MsgBox "Check your username and password again.", vbOKOnly, "inforGT"
Exit Sub
Else
stDocName = "Menu"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
However, this is generating an error 3001 "Arguments are of the wrong type, out of range or in conflict..." with the line:
oRs.Open "tblUsers", objConn, adOpenStatic, adLockOptimistic, adCmdTable
I have various ways to resolve this login feature I am not used with DAO and ADO.
If anyone has a complete sample code for a login form (plus, "Change my password" feature wud b just gr8!)- thanks
Last edited by MintFlavor; Mar 19th, 2007 at 05:54 AM.
-
Mar 19th, 2007, 08:37 AM
#2
Re: msAccess
Welcome to the forums. 
I have a question.
Your thread title says Ms Access, yet in your example you provide a connection string to SQL Server
Code:
sConn = "Provider='SQLOLEDB';Data Source='MySqlServer';" & _
"Initial Catalog='inforGT';Integrated Security='SSPI';"
Which database are you using?
-
Mar 19th, 2007, 09:33 AM
#3
Thread Starter
Lively Member
Re: msAccess
Hack
I collected codes from tutorials and assembled them to try use ADO.
I am using Ms access. Could u/someone correct the parameter values in the connection line? (if this is possible in msAccess vb)
Thanks.
-
Mar 19th, 2007, 09:52 AM
#4
Hyperactive Member
If you find information helpful from any member, please take a second and rate their post. Its a nice gesture of your appreciation.
"I have not failed 10,000 times. I have successfully identified 10,000 ways that will not work" Thomas Edison
Do illiterate people get the full effect of Alphabet Soup?
ADO FAQ 2005-2008 Masked Textbox Patch FoxPro Date MZ Tools Great Free Tool
-
Mar 19th, 2007, 09:53 AM
#5
Re: msAccess
Ok. You also did not have a connection object declared, so I made one. In addition, I moved your variable declarations from wherever they were going to be to the declarations section of the form, and created them as Private. In my example, you connect to your db when your form opens. You, of course, can move that to whereever you feel would be approrpirate.
vb Code:
Option Explicit
Private ADOCn As ADODB.Connection
Private oRs As ADODB.Recordset
Private sConn As String
Private sSQL As String
Private Sub Form_Load
sConn = = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\yourdbname.mdb;" & _
"Persist Security Info=False"
Set ADOCn = New ADODB.Connection
ADOCn.ConnectionString = sConn
ADOCn.Open sConn
End Sub
-
Mar 20th, 2007, 04:19 AM
#6
Thread Starter
Lively Member
Re: msAccess
Hack thnx a lot for your connection codes.
However, the ultimate probem i'm having is the error 2147467259 ....
which says that the state set by admin to my db prevents the connection to be opened !
Now, can i do anything to overpass that or is it simply due to my limited rights as user on the network?
-
Mar 20th, 2007, 07:24 AM
#7
Re: msAccess
Without knowing the exact error message we need to guess a bit.. hopefully one of these should provide the answer:
Does the database have a password? If so, you'll need to specify that in the connection string too.
Do you have permission to read and write the database file itself?
How about the folder it is in? (ie: can you create/edit files in that folder?)
-
Mar 22nd, 2007, 06:45 AM
#8
Thread Starter
Lively Member
Re: msAccess
Error encountered:
The database has been placed in a state by user 'Admin' on machine 'Server01' that prevents it from being opened or locked.
There is no password for opening the db, and i do have rights on the db and the folder in which it is found.
-
Mar 22nd, 2007, 06:48 AM
#9
Re: msAccess
It sounds like you have it open in Access at the same time your program is trying to open it.
I've done that before.
-
Mar 22nd, 2007, 07:57 AM
#10
Thread Starter
Lively Member
Re: msAccess
It is working only when the form is loaded after the splashscreen an dnot when i manually open the login form.
This is ok because the login will always and only run after the splashscreen in practice.
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|