Cant open next form

Aleni

Registered User.
Local time
Today, 11:13
Joined
Dec 6, 2012
Messages
45
Hi Everyone!
I have a bound form which shows list of items in the stock. When i click on a button it should open another form which shows the details of item which we choose from the first form.
the code which i have in click event of the form is :
Code:
Dim strCrit As String
    strCrit = "PkID=" & Me.RadStocks
    DoCmd.OpenForm "frmIssueRadItems", , , strCrit
It works sometimes but most of the time it gives error saying " syntax error(missing operator) in query expression 'PkID=Airmux 200E DC"
Please help to understand what it is and how to solve it?
 
When the error raise and the code is halted press CTRL+G.
This will open the Immediate window.

In this window type ?strCrit and press ENTER.

Now you will see the criteria string and, maybe, you can tweak the code.
If not, copy the string and post it here.
 
Hi Everyone!
I have a bound form which shows list of items in the stock. When i click on a button it should open another form which shows the details of item which we choose from the first form.
the code which i have in click event of the form is :
Code:
Dim strCrit As String
    strCrit = "PkID=" & Me.RadStocks
    DoCmd.OpenForm "frmIssueRadItems", , , strCrit
It works sometimes but most of the time it gives error saying " syntax error(missing operator) in query expression 'PkID=Airmux 200E DC"
Please help to understand what it is and how to solve it?

It would appear that your PK is text which then the code should be:

Code:
Dim strCrit As String
    strCrit = "PkID=" [B][COLOR=#ff0000]& Chr(34) [/COLOR][/B]& Me.RadStocks [B][COLOR=red]& Chr(34)[/COLOR][/B]
    DoCmd.OpenForm "frmIssueRadItems", , , strCrit

The Chr(34) is a double quote but it is easier to look at and remember instead of needing to show multiple ones to just get one.
 

Users who are viewing this thread

Back
Top Bottom