Glad to help good luck.
Sent from my iPhone
On Dec 16, 2012, at 11:03 PM, "The Math Doctor" <evan_j_siegel@yahoo.com<mailto:evan_j_siegel@yahoo.com>> wrote:
Thanks loads, Tim. I'm on it.
--- In AccessVBACentral@yahoogroups.com<mailto:AccessVBACentral%40yahoogroups.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<http://AllenBrowne.com>) it has been a great resource for me, I'm just learning too.
>
> Good Luck
> Tim
>
>
>
> From: AccessVBACentral@yahoogroups.com<mailto:AccessVBACentral%40yahoogroups.com> [mailto:AccessVBACentral@yahoogroups.com<mailto:AccessVBACentral%40yahoogroups.com>] On Behalf Of The Math Doctor
> Sent: Thursday, December 13, 2012 10:27 PM
> To: AccessVBACentral@yahoogroups.com<mailto:AccessVBACentral%40yahoogroups.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]
>
[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 (4) |
Nenhum comentário:
Postar um comentário