Results 1 to 6 of 6
  1. #1
    ggs is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    New Zealand
    Posts
    36

    Smile LogIn Form to filter Main Form

    hello again
    I've been having another try at my LogIn Form.
    This is not really a password security issue just to allow users to enter/edit their own details.


    tblLocation has LocID, LocName, passcode (autonumber,text,text)
    I have a combo box and a text box on my LogIn Form and a Command button. I have code on the Combo box and text box On Exit to prompt no details but trying to get the main Form open with just the Login User has seen me scouring forums all weekend. below is the OnClick for the button
    Private Sub cmdLocLogin_Click()
    Dim strWhere
    strWhere = strWhere & "[LocName]='" & Me.cboUserList
    If txtPassCode = "LocID.Column(2)" Then
    DoCmd.OpenForm "Incident Form" ' ac Normal
    Else
    MsgBox "Please enter a correct password"
    End If
    End Sub
    I know something is wrong (cause it don't work) (gets to error msg) but how many hours can one old novice spend on something so simple

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    You didn't include the closing single quote around the text value, but you never use the strWhere variable anyway. This should help:

    http://www.baldyweb.com/wherecondition.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ggs is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    New Zealand
    Posts
    36

    a question?

    mmm tried this still have a problem
    Firstly, I like your site with all those natty little tips and solutions
    now DoCmd.OpenForm "frmIncident", , , "LocName = '" & Me.cboUserList& "'" Now cboUserList is in my opening form and is Value List (that should not matter?) LocationID is the control source in my 2nd form but is the foriegn key (numeric) for the Location table LocID, LocName and passcode ( just 3 fields) (LocName is the name I'm trying to match)
    Now when I click cmdLogIn I'm asked - MsgBox - Enter Parameter Value LocName? if I enter the name or anything and OK the form will open with all records?
    If I try the LocationID I get msgbox error 3464 data type mismatch
    What am I doing wrong please

  4. #4
    ggs is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    New Zealand
    Posts
    36
    here's afunny thing I don't know why I tried this but I can open one of the reports using this code and all is fine filtered and all. now Iv'e checked and triple checked typing , most was pasted anyway.
    It's 11pm almost and I have a real job to go to
    Goodnight JohnBoy

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    The parameter prompt would indicate that the specified field is not in the record source of the form being opened. Perhaps it's spelled wrong? The type mismatch typically occurs when you use the text format for a numeric field, or vice-versa.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    ggs is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2011
    Location
    New Zealand
    Posts
    36
    well this has had me struggling. because the location is a seperate table the control source is numeric (the foreign key in the main table) Ive tried all including DoCmd.OpenForm "frmIncident", , , "LocID = '" & Me.cboUserList.Column(1) & "'" which compares the ID no's and just doesn't play the game.
    I have gone now to scrapping the location table and have the location as a value list combo box and it is all working but really this is not the right way go
    Maybe some day in the future I will have another look.
    Thanks of course for your help as I am using your code to open the main form

Please reply to this thread with any new information or opinions.

Similar Threads

  1. filter main form base on subform data
    By ss3373 in forum Access
    Replies: 7
    Last Post: 06-24-2011, 09:21 PM
  2. Subform Filter based on Main Form Information
    By james.carpenter2 in forum Forms
    Replies: 0
    Last Post: 02-16-2011, 09:55 PM
  3. Login form plus filter
    By bjelinski in forum Forms
    Replies: 1
    Last Post: 11-29-2010, 04:34 AM
  4. Replies: 1
    Last Post: 11-16-2010, 08:42 AM
  5. Replies: 7
    Last Post: 05-24-2009, 10:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums