OpenForm requesting Parameter Value

minkoffcpa

Registered User.
Local time
Yesterday, 23:06
Joined
Sep 28, 2014
Messages
11
I have a form "2017 Individual Taxes" that lists records based on a client registration form "IndivClients". The "IndivClients" form is linked to a SharePoint list so that I can synchronize it with OWA 365 and Outlook 2016. I have a command button on the "2017 Individual taxes" that is supposed to open the "IndivClients" form to the related client. The code behind the command button is:

Private Sub GoToClient_Click()

DoCmd.OpenForm "IndivClients", acNormal, , "ClientNumber=" & TaxpayerClientNo

End Sub

When launched, I get a popup "Enter Parameter Value" asking for ClientNumber. I've spent hours researching, so I'm hoping someone can help me with this. I'm not a very experienced programmer, so would very much appreciate whoever answers to use all the specific syntax (quotation marks, brackets, exclamation marks, etc.) as I'm really not familiar with when to use them and when not to.
Thank you very much! Kevin
 
The prompt is Access telling you it can't find something. It sounds like ClientNumber is not in the record source of IndivClients.
 
DoCmd.OpenForm "IndivClients", acNormal, , "ClientNumber=" & TaxpayerClientNo

should be:

DoCmd.OpenForm "IndivClients", acNormal, , "ClientNumber"= & TaxpayerClientNo
 
Is the textbox [TaxpayerClientNo] on the Form or in SubForm?
can you test the value of TaxpayerClientNo before opening the form:

Private Sub GoToClient_Click
Msgbox [TaxpayerClientNo]

'DoCmd.OpenForm "IndivClients, acNormal,,"CleintNumber=" & [TaxpayerClientNo]

End Sub
 
Is the field TaxpayerClientNo actually s text field despite its name?
If so, you need text delimiters

DoCmd.OpenForm "IndivClients", acNormal, , "ClientNumber='" & TaxpayerClientNo & "'"
 

Users who are viewing this thread

Back
Top Bottom