p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access (http://p2p.wrox.com/forumdisplay.php?f=18)
-   -   Urgent!! code for no match in Subform based query (http://p2p.wrox.com/showthread.php?t=15277)

smercer July 11th, 2004 09:57 AM

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:


  If Me!sfrm_Current_Sales_Book_Description_Count.nomatch Then

        ' 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
        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


as you can see it is quite long so I have omited the rest. I have tried the code with:

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

penta September 8th, 2004 08:50 AM

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.

smercer September 10th, 2004 11:11 PM

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

smercer September 10th, 2004 11:15 PM

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.


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

All times are GMT -4. The time now is 06:41 AM.

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