How do I get rid of "Enter Parameter Box"

potatohead

Registered User.
Local time
Today, 03:47
Joined
Dec 23, 2005
Messages
10
Hi All

I currently have a log on form that checks a users password against passwords in a table, before opening a form at that users record. Ie, If Fred Bloggs logged in with password FRED, the next form would open at Fred Bloggs' record.

I've used the following code:

Private Sub cmdOK_Click()

Dim stDocName As String
Dim stLinkCriteria As String

If Me.ConfirmPassword = Me.UserPassword Then

stDocName = "frmEditUser"
stLinkCriteria = "[UserID]=" & Me![UserID]

DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmUserPassword"
Forms!frmEditUser.SetFocus

Else

MsgBox " Password Incorrect. ", vbExclamation
Me.ConfirmPassword = ""
Me.ConfirmPassword.SetFocus

End If

However, when hitting the OK Button (with the correct details in), a pop up window appears saying "Enter Parameter Value", if I were to enter Fred Bloggs again, then the relevant record would appear, but if not, then the first record would appear.

Is there anyway for this 'Enter Paramter' window NOT to appear?

Many thanks
 
Somewhere, you have a typo. Check each controlsource on the form, check the filter and sort properties.
 
Hi Pat

I don't have anything in the control sources of the text boxes I'm refering to on the form.

Do I need anything in them?

Cheers
 
If the form is not bound, how are you displaying the data? In any event, the prompt is caused by a typo somewhere and you just have to find it.
 
You said entering 'Fred Bloggs' in the 'enter parameter' prompt makes it work the way it should, so it looks like that means that frmEditUser is not getting the userID from the stlinkcriteria. Make sure that the userID name is correct (and the same) on your login form, in your stlinkcriteria, and on your edit user form.
 
PotatoHead,

What do you expect --> Me![UserID]

to have?

I think you have a combobox on your form, bound to the UserID NUMBER.

Whatever feeds your form (a query?) expects to find the name (UserName?)

It might be equal to:

Me.UserID.Column(1)

And if it is a string:

stLinkCriteria = "[UserID] = '" & Me.UserID & "'"

Wayne
 

Users who are viewing this thread

Back
Top Bottom