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

Form Expressions 1

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
I have two tables that have a doc# that would be the same #.
In one form a dept enters data that is related to there dept. in the other form the other dept does the same.

In one of the forms I want to create a button that will open up the other form and goto the exact same doc# to show data from the other dept.

One of the reasons I cannot just put everything into one table is, I will go over the 255 fields per query or form.

any help would be appreciated
thanks
 
Can you just create a prompt query?
-Smack
 
Use this code for the button....

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "SecondFormName"

stLinkCriteria = "[doc#]=" & Me![doc#]
DoCmd.OpenForm stDocName, , , stLinkCriteria Mike Rohde
rohdem@marshallengines.com
 
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "drum pad sampling sheet"

stLinkCriteria = "[ManifestNu]=" & Me![Manifest]
DoCmd.OpenForm stDocName, , , stLinkCriteria

code didnot work...getting and operator error...

In the above i used doc# as an example..... I didnt want to confuse anyone...
 
What exactly is the error you are getting?
If manifestnu is a string variable, you'll need to use single quotes around the value:

stLinkCriteria = "[ManifestNu]= ' " & Me![Manifest] & " ' " Mike Rohde
rohdem@marshallengines.com
 
Now the form opens but the record is blank...

manifestnu is a number as follows 1234567-1A

I did in a query combine the -1a the then end of the manifestnu...

I can make this happen in a report but not in a form..

thanks
 
Insert a message box after the stlinkcriteria line:

stLinkCriteria = "[ManifestNu]= ' " & Me![Manifest] & " ' "
msgbox stlinkcriteria

When you execute the code, the message box should say:
[ManifestNu]='1234567-1A'

If it does, and you have a record in the table in the ManifestNu field that has a value of 1234567-1A, then it should open to that record.

If you are using Access 97 and the database is not too large, you can send it to me and I'll take a look at it. Mike Rohde
rohdem@marshallengines.com
 
the message box shows the manifestnu and the form opens but displays no record....right now the database is about 25mb

 
If you want, I can send you an example if you e-mail me or post your e-mail here. Mike Rohde
rohdem@marshallengines.com
 
my email is dvannoy@onyxes.com

Thanks for your help....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top