Moving Access form field value into another form (1 Viewer)

Pioneer

Registered User.
Local time
Today, 10:08
Joined
Aug 5, 2008
Messages
19
I have problem regarding from control,
I have a main form which gives details of an employee details , i create one command button which opens new form that appears last year donation detail.

my question is how to pass EmployeeID value from main form to last year form , which gives last year detail according to main form emplyeeid value, i do not want whole last year detail . i need only last year detail which is matched with employeeid value on main firm value.

Somebody helps me to come out in this problem.

i am waiting for your reply.
 

Pioneer

Registered User.
Local time
Today, 10:08
Joined
Aug 5, 2008
Messages
19
Thanks Paul

it still not works , it gives me an error "Access Type Mismatch"

can i do this things using Macro?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 10:08
Joined
Aug 30, 2003
Messages
36,133
Probably, but what exactly is your code? And what is the data type of the field in question?
 

Pioneer

Registered User.
Local time
Today, 10:08
Joined
Aug 5, 2008
Messages
19
here is the my code,,,,,,,,,,

my main form has command button callled last year, and here is the code.
and it gives an error message "Type Mismatch" ------------------------------------------------------------------------
Private Sub btnLastYear1_Click()

On Error GoTo Err_btnLastYear1_Click

Dim stDocName As String
Dim stLinkCriteria As Long


stDocName = "LastYear"

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

Exit_btnLastYear1_Click:
Exit Sub

Err_btnLastYear1_Click:
MsgBox Err.Description
Resume Exit_btnLastYear1_Click

End Sub

-------------------------------------------------------------------------
I want to pass EmployeeID value Inside Last Year Form EmployeeId , they should be uniform and only fetch details according employeeid value like..
if my main form shown EmployeeID=909090 and his employee details then,last year has employeeid= 909090 and having his donation detail about last year.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 10:08
Joined
Aug 30, 2003
Messages
36,133
And what is the data type of EmployeeID in the table? The error implies it's text, which requires a different syntax, as noted in that link.
 

Pioneer

Registered User.
Local time
Today, 10:08
Joined
Aug 5, 2008
Messages
19
Dtatype of Employee id is numeric in table.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 10:08
Joined
Aug 30, 2003
Messages
36,133
I didn't even notice this:

Dim stLinkCriteria As Long

should be

Dim stLinkCriteria As String
 

Users who are viewing this thread

Top Bottom