Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pop-Up Form Won't Work - When Datatype Changed

Status
Not open for further replies.

nubianqueen

Technical User
Apr 16, 2002
19
0
0
US
Hi Guys,
This is the problem, I have a main form, when the user double clicks in the autonumber field a popup form comes up to enter comments associated with the current record. The code looks like this:

Private Sub Policy__DblClick(Cancel As Integer)

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "CommentsPopUpForm"

If Me.Dirty Then DoCmd.DoMenuItem acFormBar,acRecordsMenu, acSaveRecord, , acMenuVer70
stLinkCriteria = "[PolicyNum]=" & "'" & Me![PolicyNum] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

I changed the PolicyNum datatype from text to autonumber.
Now when I double click in the PolicyNum field on my form I'm getting a debug error. The last line of my code is being highlighted so I image that's where the problem is, just not sure how to fix it.
Any suggestions would greatly appreciated.
Thanks
nubianqueen
 
Hi,

Change this line:

stLinkCriteria = "[PolicyNum]=" & "'" & Me![PolicyNum] & "'"

to

stLinkCriteria = "[PolicyNum]=" & Me![PolicyNum]

Cha ching!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top