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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing project number from one form to next!!! 1

Status
Not open for further replies.

smelly

Programmer
May 23, 2002
11
US
I am trying to pass a project number from form A to form B, but I am getting an error. I am using the code I found on an old thread for an on click procedure to go to the form B....
(I have a command button to open form and the code behind it is...)
stLinkCriteria = "[ProjectNumber]=" & Me![ProjectNumber]
DoCmd.OpenForm FORMB,,,stLinkCriteria

Thanks for any help!!!!!!
 
The form name needs to be a string.

DoCmd.OpenForm "FORMB",,,stLinkCriteria
 
Thanks, I fixed that but the error still reads....
Object does not support this object or method.

Private Sub Send_Number_Click()
stLinkCriteria = "[ProjectNumber]=" & Me![ProjectNumber]
DoCmd.OpenForm "Practice2", , , stLinkCriteria
End Sub


Thanks for any help!

 
I believe DoCmd are DAO's which are not available in 2000 without referenceing the DAO 3.6 library

rollie@bwsys.net
Practise does not make perfect - it makes permanent!
 
Hi,

I'm trying to do the same thing and like you, still no luck. This is what I tried:

Private Sub Send_Number_Click()
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Practice2"
stLinkCriteria = "ProjectNumber"
DoCmd.OpenForm stDocName, , , , , , stLinkCriteria
End Sub

and in Practice2, one of the text box's after update event:

Private Sub txtProjectNumber_AfterUpdate()
ProjectNumber = Me!OpenArgs
End Sub


But something's still missing.
 
Still in trouble I see (;-))

Your criteria is like saying 'PEANUTS." It does not make sense. It needs to be like the consists of a WHERE stateement. " ID = 27"

Rollie
 
Heh, I'm ALWAYS in trouble Rollie.

See, I don't really know what a LinkCriteria is.

PLEASE HELP!!

I have a thread on this too but I dunno how to link it. It's called Linking Forms and it was just updated so it should be near the top of the list of threads.
 
I have fixed my problem here is my code.....

a helpful chap by the name of pono1 suggested this bit of code and it works for me.......

Test the following by putting a command button on the practice1 form and assigning this code to its click event.

Private Sub Button_Click()

Dim PNum As Long
' TxtProjectNumber is a text field on Practice1 form
PNum = Me.txtProjectNumber

DoCmd.OpenForm "Practice2"

' TxtProjectNumber2 is a text field on Practice2 form
[Forms]![Practice2].TxtProjectNumber2 = PNum

End Sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top