Tecnologia, programação e muito Visual FoxPro.

domingo, 16 de dezembro de 2012

Re: [Access VBA Central] Getting a field from a specific record

 

Thanks loads, Tim. I'm on it.

--- In AccessVBACentral@yahoogroups.com, Tim Cogdell <tcogdell@...> wrote:
>
> Its really quite simple the function is called DLookup and it goes like this.
>
> DLookup([fieldwanted],[tablefieldislocated],[PrimaryKey])
>
> So if your table is
>
> tblEquipment
> EpuipmentID 01 ( primary key)
> ModelNumber XYZ
> SerialNumber 12345
>
> The syntax would be DLookup("[ModelNumber]","tblEquipment","EquipmentID = 01")
> It will return xyz
>
> If you want the ModelNumber to update based on the EquipmentID in a form you have can use the following syntax
>
> Field = DLookup("[ModelNumber]","tblEquipment","[EquipmentID] = " & Me.FieldName
>
> If the field is text you have to add quotes surrounding the field name
>
> As
>
> Field = DLookup("[ModelNumber]","tblEquipment","[EquipmentID = " & ' "Me.FieldName" ')
>
> Look into Allen Brownes website (AllenBrowne.com) it has been a great resource for me, I'm just learning too.
>
> Good Luck
> Tim
>
>
>
> From: AccessVBACentral@yahoogroups.com [mailto:AccessVBACentral@yahoogroups.com] On Behalf Of The Math Doctor
> Sent: Thursday, December 13, 2012 10:27 PM
> To: AccessVBACentral@yahoogroups.com
> Subject: [Access VBA Central] Getting a field from a specific record
>
>
>
> I am trying to write a VBA function which takes in a number (referencing a record's primary key) and returns a specific field in it.
>
> I'm sure this will be trivial to most of you, but I'm very new to Access VBA.
>
> Thanks.
>
> Evan
>
>
>
> [Non-text portions of this message have been removed]
>

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)
Recent Activity:
.

__,_._,___

Nenhum comentário:

Arquivo do blog