Partially written code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need a form to search my database by postcode. I have a small form linked
by macro to my main form with three objects. Text Box (labelled TypeLabel),
Field to enter postcode (labelled txtPC) and the Search button (labelled
cmdSearch).

Now On Click i need the code to search current records of the database in
the postcode field (Postcode).

So far I have

Private Sub cmdSearch_Click()
Sub FindRecord(FindWhat, [Match As txtPC], [MatchCase], [Search As
AcSearchDirection = acSearchAll], [SearchAsFormatted], [OnlyCurrentField As
AcFindField = Postcode], [FindFirst])
End Sub

I know there is something wrong in there because VB keeps highlighting in
red the [Match as txtPC] section. What can I do?
 
Match Specifies where the data is located in the field. You can specify a
search for data in any part of the field (Any Part Of Field), for data that
fills the entire field (Whole Field), or for data located at the beginning of
the field (Start Of Field). The default is Whole Field.
This was copied right out of Microsoft Visual Basic Help in Access and it
looks like "[Match As txtPC], " would not be an acceptable value to place
here. At first glance it appears to want one of three options:

1) Any Part Of Field
2) Start Of Field
3) Whole Field

Hope This Helps! Take Care & God Bless ~ SPARKER ~
_________________________________________________________________
 
Thanks.

Now - be honest. Am I way off here (with this code I mean)?

Am I going to be able to learn/write code by using Access Help? I have just
placed an order on amazon.com for VBA Programming for Dummies, hopefully that
will help even more.

I have been trying to learn this for two days now and don't seem to be
getting the hang of anything!
 
I have been dabbling in this stuff for a couple of years now and I still come
out here for answers to questions. That's how we learn in the absence of
classes. First I look in help and then I come out here. Don't feel bad and
don't get discouraged.VBA can be fun!
 
I agree. You are not way off. This IS a lot of fun and if you get good at it
they pay you for it! LOL Suckers!!! Seriously hang in there and don't give
up. There are a lot of ways to acomplish the same thing in database work. And
you get to add your own personal touch to whatever you design. It is very
pleasing to see something you have built make so many people happy and
productive. Books can teach you some, the built in help for Access and the
built in help for Visual Basic are both very educational, searching and
posting here as well as other web sites can be educational, studying other
peoples code can teach a lot as well... Experiment, develope your own style,
and you will be glad you did. If you need more help let me know I will be
more than happy to provide you with samples you can use and learn from for
whatever you are trying to achieve. I love my work! LOL Take Care & God Bless
~ SPARKER ~
 
albycindy said:
Thanks.

Now - be honest. Am I way off here (with this code I mean)?

Am I going to be able to learn/write code by using Access Help? I have just
placed an order on amazon.com for VBA Programming for Dummies, hopefully that
will help even more.
Yes, it will help. But don't stop there. Goto (<g>) the used bookstores and
look for "How To Program" books or books on programming. Also, there are lots
of sites on the basics of programming.
I have been trying to learn this for two days now and don't seem to be
getting the hang of anything!

Two days is nothing... Ask after two years... ;)

In college I learned the basics of programing. My first computer was an Apple
II, learning AppleSoft Integer BASIC, AppleSoft Floating Point Basic and doing
some assembly language modifications on the Apple DOS 16 operating system. Then
IBM BASIC (IBM XT) and Tiny BASIC (TRS-80), which I converting to IBM BASIC (I
wrote wonderful "spaghetti" code <g>). Next was Turbo Pascal. Somewhere in
there was "macros" in Lotus 1-2-3, scripting in FileMaker, FileMaker II and
FileMaker Pro on a Mac, and macros in Excel on a Mac/PC. Then there is HTML (I
use NotePad) and Javascript. I can "read" Cobol, Fortran, and a little C/C++,
Perl, Python and Java.

I loved programming dBase 2,3 and 4. And it took a *long* time for me to learn
event driven programming by myself after working so long in procedural languages.

So once you learn the fundamentals of programming, it is easier learning other
languages - it is just the syntax that changes, not the concepts. Looping is
looping in any language - you just have to learn how to write it.

So make a copy of the Northwind mdb and tear into the code. Try to analyze what
the code is doing. Do the same with the examples in the forums.

And don't give up!!


Here are a couple of links I found after I googled "VBA tutorial":

http://www.theopensourcery.com/ostutor.htm

http://www.intelligentedu.com/newly_researched_free_training/Visual_Basic_for_Applications_VBA.html


Good Luck...
 
My first computer was an Apple
II, learning AppleSoft Integer BASIC, AppleSoft Floating Point Basic
and doing some assembly language modifications on the Apple DOS 16
operating system.

Sixteen bits? Pah! Youngsters these days...


Tim F
 
Tim said:
Sixteen bits? Pah! Youngsters these days...


Tim F

I did have the top of the line external direct drive floppy drive! And the
5.25" floppy's held a whopping 160K (if I remember right)....and it cost $250!

sigh... the good old days... DOS....
 
Back
Top