Darryl Collins
Darryl.Collins at coles.com.au
Wed May 21 00:38:10 CDT 2008
hahahahaha! Excellent. Many thanks :) I knew it would have to be something really stupidly easy!!
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Stuart
McLachlan
Sent: Wednesday, 21 May 2008 3:35 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Get Value from Record Set?
Take your pick :-)
[Forms]![frm_FYP_APLID_Admin].[FYP1].Value = rs1!FYP
or
[Forms]![frm_FYP_APLID_Admin].[FYP1].Value = rs1(0)
or
[Forms]![frm_FYP_APLID_Admin].[FYP1].Value = rs1("FYP")
On 21 May 2008 at 15:25, Darryl Collins wrote:
>
>
> Hey Everyone,
>
> I want to return one value from a table and I am struggling with it. I can get the KeyID I need and can get the entry I want, but I cannot seem to actually read the value itself. Clearly I am stuffing something obvious up.
>
> Table layout is like this
>
> KeyID FYP OtherBlah OtherBlah2
> 100 FY08 01 ra ra ra ra
> 101 FY08 02 ra ra ra ra
> 102 FY08 03 ra ra ra ra
> etc
>
> The value I want back is actually the FYP field.
>
> '''--- CODE SAMPLE BELOW -------
> Sub UpdateTL_1()
>
> Dim sSQL As String
> Dim lFYPID As Long
> Dim rs1 As DAO.Recordset
> Dim db As DAO.Database
>
> 'On Error GoTo UpdateTL_1_Error
>
> lFYPID = [Forms]![frm_FYP_APLID_Admin].FYPID.Value
> lFYPID = (lFYPID - 1) ' <-- THIS GET THE KEYID.
>
> sSQL = "SELECT tbl_FY_Period.FY_P"
> sSQL = sSQL & " FROM tbl_FY_Period"
> sSQL = sSQL & " WHERE (((tbl_FY_Period.FY_P_ID)=" & lFYPID & "));"
>
> Set db = CurrentDb
> Set rs1 = db.OpenRecordset(sSQL)
>
> MsgBox rs1.RecordCount '<-- THIS RETURNS 1
> MsgBox rs1.Fields.Count '<-- THIS RETURNS 1
>
> ' AIRCODE - THIS BIT I AM STUCK ON. How do I get the VALUE of that field
> '[Forms]![frm_FYP_APLID_Admin].[FYP1].Value = rs1.Fields.FYP.Value
>
> Set rs1 = Nothing
> Set db = Nothing
>
> This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material.
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material.