Results 1 to 10 of 10

Thread: [RESOLVED] msAccess

  1. #1
    Lively Member
    Join Date
    Mar 07
    Posts
    83

    Resolved [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.

  2. #2
    Super Moderator Hack's Avatar
    Join Date
    Aug 01
    Location
    Searching for mendhak
    Posts
    58,283

    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?
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  3. #3
    Lively Member
    Join Date
    Mar 07
    Posts
    83

    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.

  4. #4
    Hyperactive Member Always_Confused's Avatar
    Join Date
    Jun 06
    Location
    Alabama USA
    Posts
    416

    Re: msAccess

    This site is very helpful

    http://www.connectionstrings.com/
    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

  5. #5
    Super Moderator Hack's Avatar
    Join Date
    Aug 01
    Location
    Searching for mendhak
    Posts
    58,283

    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:
    1. Option Explicit
    2.  
    3. Private ADOCn As ADODB.Connection
    4. Private oRs As ADODB.Recordset
    5. Private sConn As String
    6. Private sSQL As String
    7.  
    8. Private Sub Form_Load
    9. sConn = = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    10.         "Data Source=c:\yourdbname.mdb;" & _
    11.         "Persist Security Info=False"
    12.  
    13. Set ADOCn = New ADODB.Connection
    14. ADOCn.ConnectionString = sConn
    15. ADOCn.Open sConn
    16. End Sub
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  6. #6
    Lively Member
    Join Date
    Mar 07
    Posts
    83

    Red face 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?

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 02
    Location
    Bristol, UK
    Posts
    35,564

    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?)

  8. #8
    Lively Member
    Join Date
    Mar 07
    Posts
    83

    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.

  9. #9
    Super Moderator Hack's Avatar
    Join Date
    Aug 01
    Location
    Searching for mendhak
    Posts
    58,283

    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.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  10. #10
    Lively Member
    Join Date
    Mar 07
    Posts
    83

    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
  •