OpenForm requesting Parameter Value (1 Viewer)

minkoffcpa

Registered User.
Local time
Today, 07:47
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
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:47
Joined
Aug 30, 2003
Messages
36,137
The prompt is Access telling you it can't find something. It sounds like ClientNumber is not in the record source of IndivClients.
 

Tieval

Still Clueless
Local time
Today, 15:47
Joined
Jun 26, 2015
Messages
475
DoCmd.OpenForm "IndivClients", acNormal, , "ClientNumber=" & TaxpayerClientNo

should be:

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

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:47
Joined
May 7, 2009
Messages
19,249
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
 

isladogs

MVP / VIP
Local time
Today, 15:47
Joined
Jan 14, 2017
Messages
18,270
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

Top Bottom