Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 11th, 2004, 09:57 AM
Registered User
 
Join Date: Jul 2004
Location: here, NSW, Australia.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Urgent!! code for no match in Subform based query

Hi all

I am now trying to make a books sales form. When the user scans a book, I have VBA to copy data to a table tempoarly from another subform (called "sfrm_Current_Sales_For_Book_Des") based on query for record.

I have another subform (called "sfrm_Current_Sales_Book_Description_Count")ba sed on a query to check to make sure that the user has not scaned the book already, if there is no match then it will enter the data, if the user has scaned it then a message will appear and won't enter any data. (I am doing two, one for book copy (books that have same title, author etc, and one for as described, which is to be coded.)

here is my code:

 
Code:
   If Me!sfrm_Current_Sales_Book_Description_Count.nomatch Then
Code:
        ' if there is no book copies (only One ISBN Number) already scanned then
        'This section is for the copying the sfrm_Current_Sales_For_Book_Des data over to sales form
        sfrm_Current_Sales_For_Book_Des!ISBN_Number = sfrm_Current_Sales_Book_Description!ISBN_Number
        sfrm_Current_Sales_For_Book_Des!Title = sfrm_Current_Sales_Book_Description!Title
        sfrm_Current_Sales_For_Book_Des!Author_Surname = sfrm_Current_Sales_Book_Description!Author_Surname
        sfrm_Current_Sales_For_Book_Des!Author_FName = sfrm_Current_Sales_Book_Description!Author_FName
        sfrm_Current_Sales_For_Book_Des!Series = sfrm_Current_Sales_Book_Description!Series
        sfrm_Current_Sales_For_Book_Des!Category = sfrm_Current_Sales_Book_Description!Category
        sfrm_Current_Sales_For_Book_Des!Sub_Category = sfrm_Current_Sales_Book_Description!Sub_Category


        'and now for the each record in the Each_Book Subform
        sfrm_Current_Sales_For_Book_Des.SetFocus
        sfrm_Current_Sales_For_Book_Des!sfrm_Current_Sales_For_Each_Book_Datasheet_View.SetFocus
        DoCmd.RunCommand acCmdRecordsGoToNew
        sfrm_Current_Sales_For_Book_Des!sfrm_Current_Sales_For_Each_Book_Datasheet_View!Book_ID = sfrm_Current_Sales_Book_Description!sfrm_Each_Book_Sales_Selected!Book_ID
        sfrm_Current_Sales_For_Book_Des!sfrm_Current_Sales_For_Each_Book_Datasheet_View!ISBN_Number = sfrm_Current_Sales_Book_Description!sfrm_Each_Book_Sales_Selected!ISBN_Number
        sfrm_Current_Sales_For_Book_Des!sfrm_Current_Sales_For_Each_Book_Datasheet_View!Cover = sfrm_Current_Sales_Book_Description!sfrm_Each_Book_Sales_Selected!Cover
        sfrm_Current_Sales_For_Book_Des!sfrm_Current_Sales_For_Each_Book_Datasheet_View!Cost_Price = sfrm_Current_Sales_Book_Description!sfrm_Each_Book_Sales_Selected!Cost_Price
        sfrm_Current_Sales_For_Book_Des!sfrm_Current_Sales_For_Each_Book_Datasheet_View!Sale_Price = sfrm_Current_Sales_Book_Description!sfrm_Each_Book_Sales_Selected!Sale_Price

    Else


as you can see it is quite long so I have omited the rest. I have tried the code with:
Code:
If Me!sfrm_Current_Sales_Book_Description_Count!CountOfISBN_Number.Value >= 1 Then
after the else and that works.

the problem is when there is no match in the form, the text boxes are not visable, and code does not work
so does any one have any suggestions for the .nomatch?

Thanks in advance

Never give up on what you are trying to achieve because the potential is always there
Reply With Quote
  #2 (permalink)  
Old September 8th, 2004, 08:50 AM
Friend of Wrox
 
Join Date: Aug 2004
Location: , , .
Posts: 159
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Smercer!
It is surprising how long a simple task can be a long programming
road.So i use as much as possible code that have been tested and
debuged.As much as u told about ur project it seems to be similar
to the Library Case Study on Peter Wright, "Beginning Visual Basic 6",
Apress the publisher. The code can be downloaded.See the site apress.com.
Regards Penta.

Reply With Quote
  #3 (permalink)  
Old September 10th, 2004, 11:11 PM
Registered User
 
Join Date: Jul 2004
Location: here, NSW, Australia.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi penta

I have fixed the problem with append, delete and update queries. It works well now.

Thanks for your input.

Never give up on what you are trying to achieve because the potential is always there
Reply With Quote
  #4 (permalink)  
Old September 10th, 2004, 11:15 PM
Registered User
 
Join Date: Jul 2004
Location: here, NSW, Australia.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Got confused with another problem I had and neglected to read my first post after forgeting it. I now use a dlookup and that works well.

thanks

Never give up on what you are trying to achieve because the potential is always there
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
populating table from a subform based on a query bjcountry Access 1 April 11th, 2008 06:35 AM
Filter a subform based on value entered mackoy Access 1 August 25th, 2006 12:27 PM
subform based on a query Vince_421 Access VBA 2 May 10th, 2006 04:38 AM
Match element based on attribute of child? transom XSLT 1 September 11th, 2005 03:26 PM
Filter Subform B Based on Field in Subform A SerranoG Access VBA 3 June 18th, 2004 12:23 AM



All times are GMT -4. The time now is 06:23 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.