VB6 dll passing dates

S

SalimShahzad

dear gurus can you check i had written dll file in vb6 and call in
access added via reference.

here are the coding of dll file
+++++++++++++++++++++++++++++++++
Public Function f_Dtloan(dt_dob As Date, Dt_loan As Date) As Date
ageEntry = DateDiff("yyyy", "# & dt_dob & #", "# & Dt_loan & #")
End Function
+++++++++++++++++++++++++++++++++

as you know the function is written in dll, so we need to call it then
pass the value.and here are the coding of forms buttons:
+++++++++++++++++++++++++++++++++
Public objDate As New Project1.basDate

Private Sub Command1_Click()
MsgBox objDate.f_Dtloan(Text2.Text, Text1.Text)
End Sub
+++++++++++++++++++++++++++++++++
so can any one check it gives me results zero "0" always i don't know
where i am making mistakes in VB6 or VBA coding is 99% same
rgds,
shahzad
 
A

Andi Mayer

dear gurus can you check i had written dll file in vb6 and call in
access added via reference.

here are the coding of dll file
+++++++++++++++++++++++++++++++++
Public Function f_Dtloan(dt_dob As Date, Dt_loan As Date) As Date
ageEntry = DateDiff("yyyy", "# & dt_dob & #", "# & Dt_loan & #")
End Function
+++++++++++++++++++++++++++++++++

as you know the function is written in dll, so we need to call it then
pass the value.and here are the coding of forms buttons:
+++++++++++++++++++++++++++++++++
Public objDate As New Project1.basDate

Private Sub Command1_Click()
MsgBox objDate.f_Dtloan(Text2.Text, Text1.Text)
End Sub
+++++++++++++++++++++++++++++++++
so can any one check it gives me results zero "0" always i don't know
where i am making mistakes in VB6 or VBA coding is 99% same
rgds,
shahzad

don't post VB problems into an Access Newsgroup (further on in a Group
without VBA)

you define a function as Date, you calculate a number (without
defining it) and you never assign a result to your function.
 
M

Mike Preston

dear gurus can you check i had written dll file in vb6 and call in
access added via reference.

here are the coding of dll file
+++++++++++++++++++++++++++++++++
Public Function f_Dtloan(dt_dob As Date, Dt_loan As Date) As Date
ageEntry = DateDiff("yyyy", "# & dt_dob & #", "# & Dt_loan & #")

Try:

ageEntry = DateDiff("yyyy", "#" & dt_dob & "#", "#" & Dt_loan & "#")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top