Re: Return ID value of inserted record, and populate text box
- From: "Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxx>
- Date: Wed, 12 Aug 2009 13:40:40 -0400
In case any user of the database has his/her Short Date format set to
dd/mm/yyyy, you're better off using
"AND s.stu_birthday = " & Format(Me.txtDOB.Value, "\#yyyy\-mm\-dd\#")
(note that the semi-colon at the end is optional)
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"gsnidow via AccessMonster.com" <u33475@uwe> wrote in message
news:9a7d96ae04cc8@xxxxxx
Ok, not used to querying in Access. I got it to work by changing single
quotes to #...
"AND s.stu_birthday = " & "#" & Me.txtDOB.Value & "#" & ";"
Anyhow, it works, thanks for the help Doug.
gsnidow wrote:
Ok, the problem is that I am trying to compare STUDENTS.stu_birthday,
which
is a date field, to txtDOB, which is text. So, now my problem is, how to
I
convert this line...
'"AND s.stu_birthday = '" & Me.txtDOB.Value & "';"
In TSQL I would want 'AND s.stu_birthday =
CONVERT(SMALLDATETIME,me.txtDOB,
101)'
Can you tell me how to do this with VB? Thanks for the help.
Thanks for the quick reply. Well, now I am getting a different error,[quoted text clipped - 6 lines]
"Data
type mismatch in criteria expression", so I guess that is progress.
Could
Me.txtStudent_ID = (rsSTUDENT_ID("STUDENT_ID"))
Me.txtUser.Requery
--
Message posted via http://www.accessmonster.com
.
- References:
- Return ID value of inserted record, and populate text box
- From: gsnidow via AccessMonster.com
- Re: Return ID value of inserted record, and populate text box
- From: Douglas J. Steele
- Re: Return ID value of inserted record, and populate text box
- From: gsnidow via AccessMonster.com
- Re: Return ID value of inserted record, and populate text box
- From: gsnidow via AccessMonster.com
- Re: Return ID value of inserted record, and populate text box
- From: gsnidow via AccessMonster.com
- Return ID value of inserted record, and populate text box
- Prev by Date: Re: Recordcount in ADO
- Next by Date: Access 2003
- Previous by thread: Re: Return ID value of inserted record, and populate text box
- Next by thread: Option Group - Clear Yes/No
- Index(es):
Relevant Pages
|