Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / June 2007

Tip: Looking for answers? Try searching our database.

form that shows data from another table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jlydon - 29 May 2007 23:45 GMT
I want to make a form for a library where I scan in the book barcode
and automatically it will show on some part of the form the name and
author of the book (information stored in a table which has the
barcode information, etc).  Then I can scan in the student ID to check
out that book. When I scan in the student ID the name and information
on the student (stored in a student table) will also come up.  Is this
possible?
Thanks for any guidance.
Klatuu - 30 May 2007 13:51 GMT
A sub form would be useful for this.  I do have a thought that may cause you
to reconsider your design.  A borrower may check out more than one book at a
time, but a book cannot be checked out by more than one borrower at a time.  
Therefore, I would suggest the main form be based on the borrower table and a
sub form based on the books table.
Signature

Dave Hargis, Microsoft Access MVP

> I want to make a form for a library where I scan in the book barcode
> and automatically it will show on some part of the form the name and
[quoted text clipped - 4 lines]
> possible?
> Thanks for any guidance.
Andy Hull - 30 May 2007 13:54 GMT
Hi

Yes, this is possible. Add unbound text boxes to display the info and use
the dlookup function as their source or to set their value using VBA code...

dlookup("Title", "tblBooks", "BookBarCode = " & Me.BookBarCode)
dlookup("ForeName", "tblStudents", "StudentBarCode = " & Me.StudentBarCode)
dlookup("LastName", "tblStudents", "StudentBarCode = " & Me.StudentBarCode)

Obviously, replace with your table names and column names. I have assumed
there are controls on your form called BookBarCode and StudentBarCode.

Hope this helps

Andy Hull

> I want to make a form for a library where I scan in the book barcode
> and automatically it will show on some part of the form the name and
[quoted text clipped - 4 lines]
> possible?
> Thanks for any guidance.
jlydon - 30 May 2007 20:36 GMT
I tried putting in the VBA code as you have it (changing the names for
the correct ones) but in the unbound text box there show up the
following #Name?
Does the table Books have to be in this same database.  Right now it
is in another database and I link to it from the bookstatus database.
I don't know if that would be the problem, or something else causes
the #Name? to show up.
I appreciate any guidance.
John

On May 30, 7:54 am, Andy Hull <AndyH...@discussions.microsoft.com>
wrote:
> Hi
>
[quoted text clipped - 20 lines]
> > possible?
> > Thanks for any guidance.
Andy Hull - 30 May 2007 21:18 GMT
Hi

Try an = at the beginning, like...

=dlookup(...

> I tried putting in the VBA code as you have it (changing the names for
> the correct ones) but in the unbound text box there show up the
[quoted text clipped - 32 lines]
> > > possible?
> > > Thanks for any guidance.
jlydon - 30 May 2007 23:47 GMT
Thanks for the help. Unfortunately that did not do anything.  The
program had already put the = in front.
Hopefully you can give me another idea to try. Thanks
John

On May 30, 3:18 pm, Andy Hull <AndyH...@discussions.microsoft.com>
wrote:
> Hi
>
[quoted text clipped - 38 lines]
> > > > possible?
> > > > Thanks for any guidance.
Andy Hull - 31 May 2007 10:10 GMT
Hi again John

If you are setting your display with VBA code use the expressions as I've
stated...

dlookup("Title", "tblBooks", "BookBarCode = " & Me.BookBarCode)

If you are setting the control source then drop the Me. so the expression
is...

dlookup("Title", "tblBooks", "BookBarCode = " & BookBarCode)

Note, i've assumed BookBarCode is numeric. If it is text you will need to
put single quotes around it so the 2 versions of the expression become...

dlookup("Title", "tblBooks", "BookBarCode = '" & BookBarCode & "'")
or
dlookup("Title", "tblBooks", "BookBarCode = '" & Me.BookBarCode & "'")

Sorry for the confusion - hope this helps

Andy Hull

> Thanks for the help. Unfortunately that did not do anything.  The
> program had already put the = in front.
[quoted text clipped - 45 lines]
> > > > > possible?
> > > > > Thanks for any guidance.
jlydon - 03 Jun 2007 04:22 GMT
Dear Andy: Thanks again. I just got back from a trip so only now could
try again.  I would like to clarify the following:
BookBarCode= is enclosed in double quotes
This is followed by a single quote since it is a text field and not a
number field
Then comes &BookBarCode&.  How is this followed by a single quote, or
is the single quote then followed by a double quote as seems to be the
case from the text?

I am typing in the text where it says Control Source on the properties
menu, so I don't know if thea is VBA code or not.

Thanks for clarifying.
John
On May 31, 4:10 am, Andy Hull <AndyH...@discussions.microsoft.com>
wrote:
> Hi again John
>
[quoted text clipped - 68 lines]
> > > > > > possible?
> > > > > > Thanks for any guidance.
Andy Hull - 04 Jun 2007 09:41 GMT
Hi again John

Here is the statement with asterisks where there should be single quotes so
it is easier to see...

dlookup("Title", "tblBooks", "BookBarCode = *" & BookBarCode & "*")

Note this is assuming the is a table called tblBooks with a field called
BookBarCode and that your form has a control called BookBarCode.

Regards

Andy Hull

> Dear Andy: Thanks again. I just got back from a trip so only now could
> try again.  I would like to clarify the following:
[quoted text clipped - 84 lines]
> > > > > > > possible?
> > > > > > > Thanks for any guidance.
jlydon - 05 Jun 2007 04:19 GMT
Dear Andy: Many thanks.  That worked great.  John

On Jun 4, 3:41 am, Andy Hull <AndyH...@discussions.microsoft.com>
wrote:
> Hi again John
>
[quoted text clipped - 98 lines]
> > > > > > > > possible?
> > > > > > > > Thanks for any guidance.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.