Open form using non PK field (1 Viewer)

Locopete99

Registered User.
Local time
Yesterday, 21:52
Joined
Jul 11, 2016
Messages
163
Hi Guys,

Its been a long day so i might be being stupid.

Can you open a form using the Docmd.openform command, but not use the PK index field?

I have a machine table and a field that is Symbol on machine but I cannot get it to open:

Code:
ID2 = InputBox("Enter Symbol or # on layout")
DoCmd.OpenForm "Frm_Machine", acNormal, , "Me.symbol=" & ID2

The symbol field is a short text field.

What am i doing wrong?
 

jdraw

Super Moderator
Staff member
Local time
Today, 00:52
Joined
Jan 23, 2006
Messages
15,364
symbol field is a short text field
How about an example?
What is ID2? a string?

Perhaps
Code:
DoCmd.OpenForm "Frm_Machine", acNormal, , "Me.symbol=[COLOR="Red"]'[/COLOR]" & ID2 & "[COLOR="red"]'[/COLOR]"
 

Locopete99

Registered User.
Local time
Yesterday, 21:52
Joined
Jul 11, 2016
Messages
163
Thanks guys, I'd forgotten to put the right syntax as per jdraw
 

bastanu

AWF VIP
Local time
Yesterday, 21:52
Joined
Apr 13, 2010
Messages
1,401
I think you got the Me. wrong, you should try:

Code:
DoCmd.OpenForm "Frm_Machine", acNormal, , "Symbol='" & [COLOR="Red"][B]Me.[/B][/COLOR]ID2 & "'"

Cheers,
Vlad
 

Locopete99

Registered User.
Local time
Yesterday, 21:52
Joined
Jul 11, 2016
Messages
163
Nope, ID2 is the text input field not one of my table fields, so pretty sure that wasn't it.

Anyway, its solved now thanks to Jdraw
 

Users who are viewing this thread

Top Bottom