Enter Parameter Box Help

SantasLittleHelper

Board Regular
Joined
Nov 25, 2016
Messages
77
On a Form, I have a button to open a different form based on the current URN displayed. The code is below:

Code:
Private Sub Button1_Click()
DoCmd.OpenForm "frm_01", , , "[Company URN] = " & Me![Company URN]
End Sub

This code works but everytime a user clicks on it, an 'Enter Paramater Box' appears. It displays the current URN and they need to copy the URN into the box. The image below may help understand... In this example, I have tried to open a form to the URN 'TESTURN123'. To open the form, I need to enter the exact URN into the box.

https://i.postimg.cc/J4V24w9L/Untitled.png

Is there a way of preventing this (what seems to be a validation step)?
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
You are passing the filter this: [Company URN] = TESTURN123

So your form is not interpreting the TESTURN123 as a string.

Try this:

Code:
DoCmd.OpenForm "frm_01", , , "[Company URN] = " &  "'" & Me![Company URN] & "'"

Which should evaluate to: [Company URN] = 'TESTURN123'
 
Upvote 0

Forum statistics

Threads
1,223,247
Messages
6,171,007
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top