stLinkCriteria problem Access 2000

rtdc

Registered User.
Local time
Today, 12:20
Joined
Feb 27, 2007
Messages
55
I am trying to open another form from a double click on a combo box and it won’t work, I have done this before without problem but for some reason it won’t play. It’s giving me a headache, Help.

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Assets"

stLinkCriteria = "[SerialNo]=" & Forms![Items at Branch]![Items at Branch SUB FRM].Form![ItemSerialNo_Field]
DoCmd.OpenForm stDocName, , , stLinkCriteria

What am I missing? (apart from a brain).

Cheers.
:mad:
 
Try this

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Assets"

stLinkCriteria = "[SerialNo]=" & Forms![Items at Branch]![Items at Branch SUB FRM].Form![ItemSerialNo_Field]
msgbox(stLinkCriteria)
DoCmd.OpenForm stDocName, , , stLinkCriteria

It will let you see what you passing to OpenForm and you may be able to see what the issue is.
 
Hi

I tried your code and it retuened

[SerialNo] = CZC7534VDM

So I changed code do it passed just CZC7534VDM but it still won’t work.

You can tell is Monday.

Cheers.
 
Hi

I tried your code and it retuened

[SerialNo] = CZC7534VDM

So I changed code do it passed just CZC7534VDM but it still won’t work.

You can tell is Monday.

Cheers.
Is that a valid serial number?
 
Fixed it

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Assets"

stLinkCriteria = "[SerialNo]= '" & Forms![Items at Branch]![Items at Branch SUB FRM].Form![ItemSerialNo_Field] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

I Knew it must be a simple fix.

Cheers
:)
 
Glad to hear you got it fixed. Its sometimes easier to see missing quote numbers when you display the criteria temporarily.
 
Because your Serial Numbers in Table are Alphanumeric (contains Characters and numbers) it tells me that the Data Type for this Table Field is of the Text Data Type .You will need to use apostrophes withing your Criteria string:

stLinkCriteria = "[SerialNo]='" & Forms![Items at Branch]![Items at Branch SUB FRM].Form![ItemSerialNo_Field] & "'"

.
 

Users who are viewing this thread

Back
Top Bottom