Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Make A Number A Multiple Of 24...


Whats the best way to make a numbmer a multiple of 24...
EX:

12 = 24
72 = 72
97 = 120
46 = 48
etc... it must round up...

Thanks!




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How Can I Make A Report That Can Display The Number Of Parts Tested And The Number Of Parts Failed T
I have one access database,One table have such fields as "ProductName","TestTime","PassTestOrNot"....In these fields,","PassTestOrNot" is boolean,I can calculate the total number by count the number of "PassTestOrNot".I need to make a report that can calculate the total tested product number and the passed product number.So the final report fields may have fields like "ProductName","TestTime","Total Tested Number","Passed Number","PassRatio"...
I am now thinking of doing this by Data Environment and Data Report,but I don't know how to make such a report that can display "Total Tested Number","Passed Number","PassRatio" at the same time.I now have a SQL like this:"Select ProductName,count(PassTestOrNot)..."
Can you Help me?

Thank you!

Multiple Of Some Number
Hi!

How can I find a multiple of some number?

Example!
Number: 6
Multiple: 1,2,3,6

Thank you

Multiple Serial Number's - Please! :)
Hello all. I am getting through this problem but ran into another wall. This is my code below.

Code:
Option Explicit
Private Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal

lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long,

lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal

lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
Private Sub Form_Load()
Dim strSerial As String
strSerial = GetSerialNumber("C:")
If strSerial <> "137773915" Then Unload Me
End Sub
Private Function GetSerialNumber(strDrive As String) As String
Dim serialnum As Long
Dim res As Long
Dim Temp1 As String
Dim Temp2 As String
Temp1 = String$(255, Chr$(0))
Temp2 = String$(255, Chr$(0))
res = GetVolumeInformation(strDrive, Temp1, Len(Temp1), serialnum, 0, 0, Temp2, Len(Temp2))
GetSerialNumber = Trim(Str(serialnum))
End Function
This will let only the users I want to to be able to open the form. So on form load it will only let people in it if their number is there. This code is amazing but the only problem is how can I make it so it is 2 numbers instead of just 1. I mean so instead of jsut that number in the code now I want my other friend we will say to be able to use it. I tried doing:
If strSerial <> "137773915" Then Unload Me
again but it will unload even though my number is correct. So it seems if your hard drive number is not all of them it will not load. So I am looking for some help so I can add mroe then 1 persons number to be able to open my program. Well if you can get this for me you would be god. Hehe. Well thank you in advance for all your help and its appreciated greatly. Thank you all and have a good one.

Multiple Serial Number's - Please! :)
Hello all. I am getting through this problem but ran into another wall. This is my code below.

VB Code:
Option ExplicitPrivate Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal  lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long,  lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal  lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As LongPrivate Sub Form_Load()    Dim strSerial As String    strSerial = GetSerialNumber("C:")    If strSerial <> "137773915" Then Unload MeEnd SubPrivate Function GetSerialNumber(strDrive As String) As String    Dim serialnum As Long    Dim res As Long    Dim Temp1 As String    Dim Temp2 As String    Temp1 = String$(255, Chr$(0))    Temp2 = String$(255, Chr$(0))    res = GetVolumeInformation(strDrive, Temp1, Len(Temp1), serialnum, 0, 0, Temp2, Len(Temp2))    GetSerialNumber = Trim(Str(serialnum))End Function

This will let only the users I want to to be able to open the form. So on form load it will only let people in it if their number is there. This code is amazing but the only problem is how can I make it so it is 2 numbers instead of just 1. I mean so instead of jsut that number in the code now I want my other friend we will say to be able to use it. I tried doing: If strSerial <> "137773915" Then Unload Me again but it will unload even though my number is correct. So it seems if your hard drive number is not all of them it will not load. So I am looking for some help so I can add mroe then 1 persons number to be able to open my program. Well if you can get this for me you would be god. Hehe. Well thank you in advance for all your help and its appreciated greatly. Thank you all and have a good one.

How To Make A Random Number?
Hi guys,

I have a progressbar... i want the value of the interval to be "random"... because if I set it to 100 or 500, everytime, it's going to take just the same time to complete a task... so I wanted to give that "Professional" look by setting the timer at random interval...

How should I go about doing this?


thanks!

-BC

Make VB Determine If Number Is Odd Or Even/
Is there a way to make visual basic know if a number is odd or even..


i want to use it with if then stuff.

if txt1.text = odd then.....

if txt1.text = even then...


how would that actually be done...

How Can I Make The Number In LCD Display?
I am trying to make my numbers which will be displayed in a text box, can look like those on LCD display. Does anybody know hot to do that?

Make A Random Number
how do you make a number between 10000 and 99999 apear in a text box when you press a button?

Random Number In Multiple Labels
hi i have a app that produces random numbers on form load and displays this random number into several labels (22 to be precise) the thing is they all display the same number which i need to not happen is there away that someone could looke at my random code and let me know how to change it so that all 22 labels display an individual number.


Code:
Private Sub Form_Load()
Dim nTry As Integer
Dim MyCollection As New Collection

Randomize

Do While MyCollection.Count < 22
nTry = Int(22 * Rnd + 1)
' If the number is already in the collection an error is generated
' so it is not added
On Error Resume Next
MyCollection.Add CStr(nTry), CStr(nTry)
If Err.Number = 0 Then
Label1.Caption = nTry
Label2.Caption = nTry
Label3.Caption = nTry
Label4.Caption = nTry
Label5.Caption = nTry
Label6.Caption = nTry
Label7.Caption = nTry
Label8.Caption = nTry
Label9.Caption = nTry
Label10.Caption = nTry
Label11.Caption = nTry
Label12.Caption = nTry
Label13.Caption = nTry
Label14.Caption = nTry
Label15.Caption = nTry
Label16.Caption = nTry
Label17.Caption = nTry
Label18.Caption = nTry
Label19.Caption = nTry
Label20.Caption = nTry
Label21.Caption = nTry
Label22.Caption = nTry
End If
Loop
End Sub


hope someone can help thanks

Saving Multiple Files With Same Name, Different Number
I have written a small special purpose text editor that I use to prepare draft copies of text documents in the law office where I work after school. It works great, but I need to add a feature to it, if possible.

A legal document may have a newly edited draft each day for several days. I am required to save these progressive drafts by the same name with a progressing number. i.e. Excell01, Excell02, Excell03, etc.

My question: Can someone please give me a sample code that I can include in my text editor that will allow me, when saving a file, to type only the file name (without the number) and have the program look up and add the next available number to the end of the name. It's often difficult and time consuming to find the next available number.

Please help if you can!

Thanks!

Wendy

Make Divide Equal A Whole Number
Iv got a function that randomises numbers and then you have to work out the answer.
when it randomises for divide, it always gives bad numbers that eqaul to decimal answers like 103 / 11.
how can i make it choose numbers that only equal a positive, whole number??

How To Make It So That User Must Enter Only Number
so yea how do i make it so that a user can only input numbers into an input box otherwise a msg will be displayed saying that user must enter only a number value

How To Make A Negative Number Positive?
Hello people!

My first time posting here. The forum has been great, and I am confident I will get an answer on this question. Thanks in advance.

I have this negative number, let's call it "-32". I want to turn that into positive "32". But the number can change - sometimes its 64 or 128, and I want my code to just sort of flip it around to positive - or quite simply remove the substraction mark.

Is there a quick way to do this?

Oh, and the number is a Long.

Thanks!

Make A Random Number In A Certain Range
How do I do a Random() Function Within a certain range.

I want my vb script to pick a number 1 thur 10

Thanks

Take A Number String And Make It A Date??
I'm know how to split a date to a string ex. 10/12/03 would be 101203 but how would I convert the string back to a date. I want the user to type in a date without the "/" and either in the change or lost focus event it would reformat the string to look like a date. I'll check for the length and if its 6 like in the example above I would just add "/" marks every two characters My brain is just fried and I know it has to be easy. I just can't remember how to count characters.Like another example if they typed in 1103 I would check for length = 4 and just add slash marks 1/1/03.... can someone help????

Make Array Be In Order By Number
How can I make an array be in order by value from s to n s is equal to where to start and n is equal to where to stop sorting.. e.g.

Lets say that the array looked something like this

a(0)=3
a(1)=1
a(2)=4
a(3)=2

I want the array to be like this

a(0)=1
a(1)=2
a(2)=3
a(3)=4

Whats the quickest way of sorting an array like that. and also whats the quickest way of sorting an array from s to n.

Thanx in advance!

Make Texbox Accept Only Number
How can I make the textbox accept only number and give message box if insert in it string . and vice versa ..

How To Make Number Increment In A String?
For example the last member's ID from the database is "TP0022", then if got another guy make a new registration he/she will get the ID "TP0023".

Make A Positive Number - Negative
How do i make a positive number which is assigned to a variable, a negative one.

So

PA = (Aptelev) - (intDiffQ)

If intDiffQ was positive, how do i make it negative before storing it in PA. Is there a Function to it?

the reason I ask is because sometimes the value of Aptelev is -12 and the value of intDiffQ is Positive. I want the answer to be positive but i keep getting a negative number!


Any ideas?

Make Textbox Only Input Number
I have this example:


Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 And KeyAscii <> Asc("-") Then KeyAscii = 0
End Sub



I know this KeyAscii represents the recently inputted character. But i don't get where it comes from.

Hmm... i'm not making any sense. Where does this keyascii come from and how does it work? All i'm asking about is the keyascii variable which i don't understand where it comes from and what it is.

Have A Negative Number Just Need To Make It Positve In Sql
I am getting a result with in a column of say -1 how to I change this in sql by adding or whatever to make it 1?????

Thanks Gurus

Get Project Make Version Number?
I would like to have the actual Project Version Major, Minor and Revision set to String in my module. Is there a way to do it automatically?
Until now I do it the usual way "Version = 1.2.1"

Thanks

Make A Number Evenly Divisible
What is the best way to make a number evenly divisible?  Here is what I have and I am open to suggestions.  Thanks.

CODEMakeEvenlyDivisible 17,6

Function MakeEvenlyDivisible(EvenlyDivisibleNumber As Long, Divisor As Long)
  EvenlyDivisibleNumber = Abs(EvenlyDivisibleNumber)
  Divisor = Abs(Divisor)

  If EvenlyDivisibleNumber Mod Divisor <> 0 Then
    Msgbox (EvenlyDivisibleNumber - (EvenlyDivisibleNumber Mod Divisor)) + Divisor
  Else
    Msgbox EvenlyDivisibleNumber & " is already evenly divisible!"
End If
End Function

How To Select Multiple Columns With Column Number
i am currently using

Code:
sheet1.columns(5).select
and it works fine ...
however, lets say i want to select columns 5 - 10, i can't fingure out how to do this without converting the column number to a letter first.. can anyone help ... thanks

Adding Multiple Serial Number Into One Field
Hello all,

Is there any way to add multiple serial numbers into one database field and have it listed something like this

Example:
Returned_Equipment (This would be my field)

10010
10070
17010
17035
on and on

Is there another way besides using something like Return1, Return2, Return3 and so on?

I am using Microsoft Access 2000 with Visual Basic 6 Pro.
Still trying to figure all this database stuff out.

Thanks in Advance,

Mike

Mike Haas

How Do You Make Multiple Tables
I used the below code to make a database with one table. Tried with no success to make an additional table by duplicating the table creation code. Question: How do I create a second table. Also, how do I index it? - Steve

Private Sub builddb()
'
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
CurDir & "airmen_test.mdb"
Dim objcat As ADOX.Catalog
Dim objMyTable As New ADOX.Table

Set objcat = New ADOX.Catalog

objcat.Create strConnection
objcat.ActiveConnection = strConnection

With objMyTable
.Name = "tbl_dom_info"
.Columns.Append "first", adVarWChar, 20
.Columns.Append "middle", adVarWChar, 20
.Columns.Append "last", adVarWChar, 20
End With
objcat.Tables.Append objMyTable

Set objMyTable = Nothing
Set objcat = Nothing

End Sub

Is The Only Way To Make Multiple Instructions...
What is the way to make multiple instructions happen in order, from a Command1_Click()?

I was earlier suggested that I use a timer, yet Im not so sure that, that is proper. What would YOU do to have three instructions take place in ORDER, after a command1_click()?
(It's got to be in order not all at once.)

Many thank you's to ya,
Daniel Christie

How To Make My Program Not To Show A Letter Or Number ?
How to make my program not to show a letter or number ?

ok i want that my textbox doesent show a number or a letter how can i do this by using

Private Sub Text1_KeyPress(KeyAscii As Integer)

End Sub

any idea ?

How Can I Make A Trial Version For A Number Of Days
Hello All,


I want to create a trial version of my VB Project for 7 days so that after that certain no.(7) of days from installation the application won't run any more.

How To Make Scrollbar To Change The Number In Textbox?
hi if there is a scroll bar and a textbox in my form, I want to use the scroll to change number in the text box, let's say if I click the up at scroll bar and the textbox will disply 1 and if I click down at the scroll bar and the textbox will display 0.

any info would be appreciated!

thanks a lot!

Make A Form A Goto Record Number
hi.

i have a form with text boxes etc that is used to navigate through a table.

I use the following code:
DoCmd.GoToRecord acDataForm, "frmNavigation", acGoTo, lngRecord

to goto a certain record where lngRecord is the record number.

However, what I want this to go to is not the record number but the record id (the primary key)

so say I have the following data in a table:

RecordID
2
3
5
8
9

and I want it to make the navigation form change to record ID 5, lngRecord would equal 3.

BUT I dont know that the record with RecordID=5 is record number 3. so how do I find it out?

so Basically I want something like:
DoCmd.GoToRecord acDataForm, "frmNavigation", acGoTo, "WHERE RecordID=5"

hope that makes sense.
thanks

How Do You Validate Text Entry To Make Sure It's A Number?
I have text boxes that I need to validate to make sure that a number is being inputted instead of, say, a word. What's the best way to do this? So far i've come up w/ a way to block normal text from being entered, but is there a better way?

~Bailey


"There are a million beautiful girls in the world. Not all of them bring you lasagna at work. Most of them just cheat on you."
~The wisdom of Silent Bob

Help On Code To Make Sure No Duplicates For Employee Number
basing on a code i've seen in one of the topics here, i placed this on my query:

Code:SELECT COUNT(*) from tblEmpInfo WHERE EmpInfo = "# & txtFields(0).Text & "#", db, adOpenDynamic, adLockOptimistic


however, it won't accept the query i've used. an error occurs whenever i ran it.

please help. tnx!



Edited by - newbie2005 on 2/18/2005 12:57:34 AM

How Do I Make It So I Can Go Through Multiple Forms In My Program?
Ive finished my program, but i have one problem. I cant just be able to go through the forms. Can someone help me?

Make Recordset Available To Multiple Forms
Guys

How can I create a recordset in one form and still have it available in another?

I need to be able to select a record then, depending on a few things, update it in a later form.

Cheers

Make Controls Visible Based On Number Of Records
Ok, what I am trying to do is have a form with 10 labels and textboxes on it and I want to populate these with info from another form. The initial form can have anywhere from 1 to 10 rows in a flexgrid. What I want to do is be able to walk down the flexgrid and populate and make visible the fields on the second form based on how many fields are in the flexgrid.. Here are a couple screenshots of the forms. thanks for any help.

Is There A Command To Make A Program Pause For A Specified Number Of Seconds?
Like in Q-basic where you can give the "Sleep" command. Is there something similar in vb.

I know you can do it with a timer/ Is there any other way, or is there just a "Sleep" command. I want my program to pause for 5 seconds.

Thanks,
M

Multiple Replacement Functions But Can't Make It Swap!
Hello,
Thanks a lot for replying so fast. I tried running the code you sent and it was fine: It changed the words round and replaced just like I wanted. I added wildcards and that worked too.
However, when I tried to add entries to the array, it refused to swap the words round.
In these following two examples, I want to replace
a) any word beginning with “L” by “SING” and place it in front of the word that comes before it:
AND,
b) any word beginning with “C” by “COMPLAIN” and place it in front of the word that comes before it:

So if I take the following:
“She said she’d SOMETIMES LIE but then again, her brother said she’d OFTEN COUGH – I would STILL COMPETE but I NOW LIE

The result I WANT is:
“She said she’d SING SOMETIMES but then again, her brother said she’d COMPLAIN OFTEN– I would COMPLAIN STILL but I SING NOW

Help! The result I GET is:
“She said she’d SOMETIMES SING but then again, her brother said she’d OFTEN COMPLAIN – I would STILL COMPLAIN but I NOW SING
(i.e., the words are replaced but not swapped)

What am I doing wrong now?
I had to add some bits of code, so I wonder if I’ve put my Do While/loop in the correct place?
Thanks for your help so far.. I’m pleased . But if you can help me really fix this I’ll be an even happier man!

Here’s my code then:
Option Base 1
Sub Swop_and_Replace()
Dim tableau
Dim i As Integer

tableau = Array("<(l*)>", "SING", "<(c*)>", "COMPLAIN")

Set myRange = Selection

For i = 1 To UBound(tableau) Step 2
Do While Selection.Find.Found
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveLeft Unit:=wdWord, Count:=1
Selection.TypeText Text:=tableau(2) & " "
Selection.Find.Execute
Loop

With Selection.Find
.Text = tableau(1)
.Forward = True
.Wrap = wdFindStop 'instead of wdFindAsk that prompts you to check each time
.MatchWildcards = True 'because I'm using wildcards to capture similar words
End With

myRange.Find.Execute FindText:=tableau(i), ReplaceWith:=tableau(i + 1), Replace:=wdReplaceAll


Next i

End Sub

How Do You Make Multiple Line In A MsgBox Window
Hi Everyone,

I am trying to figure out how to make multiple lines to be displayed in a MsgBox window. The information to be displayed makes for a long window and I would like to shorten it. Kind of like what wordwrap does.

thx,

IF

Make Sure Txtbox Is Not Empty...for Multiple Txtboxes
Can someone tell me a neat way to check many text boxes to make sure there is some value in it?

I have a form that the user enters information into and I don't want them to be able to print a report with any of the text boxes empty....

How To Make MDI Form To Support Multiple Set Of Menus?
How to make MDI form to support multiple set of menus?

I am designing a MIS application where multiple users will log-in to the MIS application.

It requires different combination of menus in MDI form depends upon the user requirements. The problem is that MDI parent form supports only one set of Menu and making use of 'hide menu' option is of no much use.

What I need is that:

1. Is there any way to show different set of menus in MDI parent form depends of user who logged-in?

2. Adding a different menu in MDI child form doesnt solve my problem, as I expect parent MDI form must have required menu during user session irrespective of which form he is using.

How To Make Multiple Queries On One Data Report
Hi there, I Want To Design A Data report, So I Added A data environment & Data report , Created A Connection & Command1, in Command1 I Use SQL Query, So I need To Get Multiple Values From Different Tables,So:
i write An SQL Query:
SELECT * FROM students WHERE (SName = ?)
So I Can bound the result to textboxes on the report, but i need also to bound other results from different queries,
i tried to make another command, but the problem is that the data report is taking on command a once ,
wish to find an answer,

How To Make A Multiple Connection Chat Room?
I'm designing a chat room with visual basic 6 enterprise.. and i'm usin da winsock control.. but how can i let more than 2 people talk.. kinda like an aim/icq chatroom.

any help is welcome
-da404LewZer

Make Auto Number On Detail Section (data Report)
How to make autonumber on detail section (data report) as many as record numbers.

Thank friends

I Want To Make Installation With Serail Number By Package && Deployment Wizard
I want to make installation with serail number or password by Package & Deployment Wizard.
 What can i do ?

How To Find Line Number For Specific String In Multiple Text Files
Hallo, I have difficulty in finding the line number for specific string.
Would you kindly help? this is what i get so far.


Code:
Dim ff As Integer
Dim mypath As String
Dim p As String
Dim strbuff As String

Open "c:
esult.txt" For Output As #1
mypath = "C: ext"
p = Dir(mypath)

List2.Clear

Do Until p = ""

If InStr(p, ".txt") Then
ff = FreeFile
Open mypath & p For Binary As #ff
strbuff = Input(LOF(ff), ff)

If InStr(strbuff, Text1.Text) Then
List2.AddItem p
Write #1, p, Text1.Text 'planning to put line number here
End If

End If

p = Dir
Loop

Close #1


the result will be listed in a new text file as
file name, keyword, line number

thank you

Quick Q- How Do You Make A Program With Multiple Forms End When The X Is Clicked?
My program has multiple forms and I want to make it actually end when I click the X button to close it. Right now it disappears but is still visible in ctrl-alt-delete. Yes, I know this has been answered a thousand times before. Just make it a thousand and one please...

Copyright © 2005-08 www.BigResource.com, All rights reserved