Library database help

cartleman

Registered User.
Local time
Yesterday, 16:42
Joined
Dec 4, 2005
Messages
21
Hi. Newbie questions here...

1) I am making a library database. I created a simple query to identify books on loan.

I need a form to browse all books, not just the unavailible books.
However it needs to show that the book is unavailible/onloan (like my query identifies), perhaps by changing the colour to red or an "on loan" tickbox,

How do I achieve this?


2) How do I run some code on startup?
I found code to change the main background colour, but I don't want to assign a button to do it

I did search about but couldnt find the answer.

Cheers.
 
Last edited:
1) If you need to show ALL the books in your form, why do you ask for the ONLOAN books in your query?

2)Create a function named «Autoexec» in a module and put your code in it.
BTW: Why would you want to change the color using code on startup? Wouldn't it be easier to use the properties of your form?
 
check box

Add a new field to your table and set it to yes/no. Add this field to the query your are using for the form. On the form place a checkbox and set the data to the field in your query.

In the Criteria field of your query if you set it to -1 it will give you all books set to yes or the book is on loan. A setting of 0 gives no... or the book is not on loan.
 
Problem 1)

Change of plan. I need it to say "On Shelf", or "On Loan" rather than a chack box... :o
 
Last edited:
Problem 2)

I'm useless at VB stuff.. :(
Here's the colour change code:

Private Sub bChangeToWhite_Click()
SetMDIBackGround (16777215)
End Sub


Do I call the module thing "«Autoexec»" or do I write it in the code somewhere?



p.s. its the grey background of the main window, not a form
 
Last edited:
Sorry, but I cannot understand your need here. Might be that my English isn't good enough or that the wine is. Maybe some more details would help me fully understand what you really want to do.
 
I want to be able to have the background colour different when I open the database file.

I do not know how to create a function or anything.
I do not know what to do with the word "autoexec"

I have next to no VB ability!
 
OK!
Open your database and create a new module.
Then, add this code on the new page:

Code:
Public function Autoexec()
    SetMDIBackGround (16777215)
End function

That should do the job, although I haven't tested it yet.
Come back if you still need help with it.
 
Last edited:
You'll have to create a macro that you also call «Autoexec» which you make execute the function «Autoexec()».
By the way, to use the «SetMDIBackGround» function, you'll need a specific DLL which I don't know the name. If you don't have it in, you'll receive a message that would say that it can't run the function. You'll have to ask the person who gave you the code for the name of the appropriate DLL. You can also ask in the forum since someone might know about it.

That's as far as I can go about it. Hoping that I was of some help.
 

Users who are viewing this thread

Back
Top Bottom