By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,480 Members | 763 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,480 IT Pros & Developers. It's quick & easy.

Using a "where condition" with DoCmd.OpenForm

P: 7
I am trying to open the form "frmClients_Main" to the record that is specified by the end user. Here is the code:

Public Function IDSearch()
'This function allows the user to open the main form to a particular client record.

Dim stSql As String
Dim stInput As String

'InputBox prompts user to enter client ID for the form they wish to open.
stInput = InputBox("Enter Client ID", "Search for Client ID", "Client ID")

'open form to record that matches the client ID entered by user.
DoCmd.OpenForm "frmClients_Main", acNormal, , "[ClientID]='" & stInput & "'", acFormEdit

End Function

I’m trying to use a “where condition” to specify this, but when I run the code above I get another inputbox that prompts me to “enter parameter value” for ClientID. If I enter the clientID at this 2nd prompt, then I am able to open the form to the specified record.

Does anyone know what needs to be corrected in the syntax above? I’ve been searching online, but haven’t found any solution that works yet.

May 2 '08 #1
Share this Question
Share on Google+
1 Reply

P: 7
Never mind, I fixed it. I was referring to a field as "ClientID" when it was actually "Client_ID" (with an underscore).
May 2 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.