VBA : How 2 ... "la suite"

  • Thread starter Thread starter PHil
  • Start date Start date
P

PHil

okay thanks to Dennis I go on with my previous prob

but now I am blocked with that line

Set rs = db.OpenRecordset("SELECT * FROM [Your Query]")

I make it like that

Set rs = db.OpenRecordset("SELECT * FROM [Requete4] WHERE
((Session.NoSession) = [Forms]![Fiche de presence]![NoSession])")

and I have got a 3061 error ...
if I replace [Forms]![Fiche de presence]![NoSession] by a number it works ...
I tried also Me!NoSession but it doesnt work ...

Any help welcome !
 
Its me again.
[Forms]![Fiche de presence]![NoSession] is a variable so it needs to be
outside of your quotes

Set rs = db.OpenRecordset("SELECT * FROM [Requete4] WHERE Session.NoSession
= " & [Forms]![Fiche de presence]![NoSession])
 
Bonjour PHil, (I suppose you are french for the names you use in your code)

if [Forms]![Fiche de presence]![NoSession]) is a string do in this way

Set rs = db.OpenRecordset("SELECT * FROM [Requete4] WHERE
Session.NoSession =""" & [Forms]![Fiche de presence]![NoSession] & """")

if [Forms]![Fiche de presence]![NoSession]) is a number do in this way

Set rs = db.OpenRecordset("SELECT * FROM [Requete4] WHERE
Session.NoSession =" & [Forms]![Fiche de presence]![NoSession])

HTH Paolo
 
Thanks Dennis !

Now everything is running fine !

Dennis said:
Its me again.
[Forms]![Fiche de presence]![NoSession] is a variable so it needs to be
outside of your quotes

Set rs = db.OpenRecordset("SELECT * FROM [Requete4] WHERE Session.NoSession
= " & [Forms]![Fiche de presence]![NoSession])


PHil said:
okay thanks to Dennis I go on with my previous prob

but now I am blocked with that line

Set rs = db.OpenRecordset("SELECT * FROM [Your Query]")

I make it like that

Set rs = db.OpenRecordset("SELECT * FROM [Requete4] WHERE
((Session.NoSession) = [Forms]![Fiche de presence]![NoSession])")

and I have got a 3061 error ...
if I replace [Forms]![Fiche de presence]![NoSession] by a number it works ...
I tried also Me!NoSession but it doesnt work ...

Any help welcome !
 
Thanks I didnt have to try this as the Dennis way works :) but thanks too !

These forums are really great :)

Paolo said:
Bonjour PHil, (I suppose you are french for the names you use in your code)

if [Forms]![Fiche de presence]![NoSession]) is a string do in this way

Set rs = db.OpenRecordset("SELECT * FROM [Requete4] WHERE
Session.NoSession =""" & [Forms]![Fiche de presence]![NoSession] & """")

if [Forms]![Fiche de presence]![NoSession]) is a number do in this way

Set rs = db.OpenRecordset("SELECT * FROM [Requete4] WHERE
Session.NoSession =" & [Forms]![Fiche de presence]![NoSession])

HTH Paolo

PHil said:
okay thanks to Dennis I go on with my previous prob

but now I am blocked with that line

Set rs = db.OpenRecordset("SELECT * FROM [Your Query]")

I make it like that

Set rs = db.OpenRecordset("SELECT * FROM [Requete4] WHERE
((Session.NoSession) = [Forms]![Fiche de presence]![NoSession])")

and I have got a 3061 error ...
if I replace [Forms]![Fiche de presence]![NoSession] by a number it works ...
I tried also Me!NoSession but it doesnt work ...

Any help welcome !
 
Back
Top