View Single Post
Old July 11th, 2004, 09:57 AM
smercer smercer is offline
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:

   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