PC Review


Reply
Thread Tools Rate Thread

Getting the value of a field

 
 
gg
Guest
Posts: n/a
 
      18th Jul 2003
I am working with a form and moving the focus to certain
fields based on other factors using VBA. How do I get the
value of that field so that I can use it in other
calculations? It must be simple, but I can't find it.

Example.
Identifier 1stheader 2ndheader 3rdheader etc.
alpha 1 4 5
bravo 3 5 6
charlie 5 8 9
etc.

Depending on the outcome of other calcs, I might want to
move to Bravo and get the value of 2ndHeader. I can get
there, but don't know how to extract the value

Can someone recommend a book for access vba. I have the
step by step book, but it is hard to use as a reference,
more of a course book.
 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      18th Jul 2003
To find the value of the 2ndHeader field in the form, where Identifier is
"Bravo":

With Me.RecordsetClone
.FindFirst "[Identifier] = ""Bravo"""
If .NoMatch Then
MsgBox "Not found"
Else
MsgBox "2ndHeader is" & !2ndHeader
End If
End With

Notes:
1. If the Identifier is a Number type field, drop the extra quotes, e.g.:
.FindFirst "[Identifier] = 99"

2. It might be easier to lookup the value in the table the form is based on:
DLookup("2ndHeader", "MyTable", "[Identifier] = ""Bravo""")
For help with DLookup(), see:
http://users.bigpond.net.au/abrowne1/casu-07.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to the newsgroup. (Email address has spurious "_SpamTrap")

"gg" <(E-Mail Removed)> wrote in message
news:076601c34ce6$90508150$(E-Mail Removed)...
> I am working with a form and moving the focus to certain
> fields based on other factors using VBA. How do I get the
> value of that field so that I can use it in other
> calculations? It must be simple, but I can't find it.
>
> Example.
> Identifier 1stheader 2ndheader 3rdheader etc.
> alpha 1 4 5
> bravo 3 5 6
> charlie 5 8 9
> etc.
>
> Depending on the outcome of other calcs, I might want to
> move to Bravo and get the value of 2ndHeader. I can get
> there, but don't know how to extract the value
>
> Can someone recommend a book for access vba. I have the
> step by step book, but it is hard to use as a reference,
> more of a course book.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA IIf(myCell.Value = Array(myCell2(1).Value, myCell2(2).Value,myCell2(3).Value,myCell2(4).Value) ,"OK","No Match) EagleOne@discussions.microsoft.com Microsoft Excel Programming 2 24th Apr 2009 11:25 PM
TextBox1.value=TextBox2.value-(TextBox3.value+TextBox4.value) helmekki Microsoft Excel Programming 1 15th Oct 2004 04:15 AM
TextBox1.value=TextBox2.value-(TextBox3.value+TextBox4.value) helmekki Microsoft Excel Programming 2 15th Oct 2004 12:32 AM
TextBox1.value=TextBox2.value-(TextBox3.value+TextBox4.value) helmekki Microsoft Excel Programming 2 14th Oct 2004 05:23 AM
Re: getting #value! when I figure I should be getting a diff value Dave Peterson Microsoft Excel Programming 0 8th Aug 2003 04:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:22 AM.