Need Help Writing Code
Hi-
I'm not too well versed in VB, but managed to write a script some time ago to copy a file from one drive to another.
Now, I'm interested in writing a code that; for a specified file, it will make a compressed copy, then move it to another drive.
Essentially, I use it for backing up a MS access database from a local computer to the server, where it is backed up via tape.
(Yes, I know I shouldn't be saving database files on a workstation, but the server is so slow, it makes it hard to access the data. The backup I intend to write will occur overnight, where it can go undisturbed. I use scheduled tasks in XP to set the script in motion.)
Can anyone help?
Thanks so much.
Keith
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Make Code For Writing Code....
Hi. I'm making a control (ocx).
So, in the wizard for making controls VB writes some code in your proyect depending on what you sleect on the wizard's options: I want to do something similar.
The user of my control will open the properties page, and will select some options, after he's done I would like to write some code on the user's proyect. Is it possible???
Pls. Help In Writing A Code
Hi guys, I am an absolute newbie in Excel/VB integration. Pls. help me in one small activity. This is what I want to do - I have an Excel file/sheet which has a command button and many columns containing numerical data like A1, A2,...B1, B2,...C1,C2....etc.
I have developed a separate VB form (EXE) with many text boxes and some processing based on those text boxes.
As soon as the command button of excel sheet is pressed, the standalone VB EXE is called (using SHELL command) and all the text boxes of the form should be populated with the value in the last cell of columns. e.g. if the last column of A (containing data) is A10 then textbox1 should get the value of A10 and similary other text boxes.
Pls. help me in this coding.
Let me know if there is anything which is not clear.
Thanx and Regards
Writing Code
I need help writing a grade averaging program with 4 input boxes where the 4th box "final grade" will replace the lowest grade or only be counted once. Any takers?
Re-writing Code In VB6
I currently have code written in old Basic to access data on a VAX systems. Well, I want to be able to access this same data with my PC by rewriting it in VIsual Basic6. I know how to access our VAX by going through a com port but to rewrite the programs I need to know how to include the maps and libraries like the old code does. Basically, Here is a beginning example from the old basic code:
%Include "scs_def_bas" %from %library "SCS$LIBEF.TBL"
MAP (TESTS) String Test.All$ =512
How do I write the above code in VB6 so it will include it. The rest I can handle.. Hope this makes sense.
Hurley
Writing A Xml Code
I've got this writing a xml file, but it adds " before and after each line. how can i remove that??
VB Code:
Private Sub Command4_Click()Open "C:Documents and SettingsOwnerDesktopVB APP
ews.xml" For Append As #1Write #1, "<Users>"Write #1, "<name>" & Text1.Text; "</name>"Write #1, "</Users>"MsgBox "All Done"Text1.Text = ""Text2.Text = ""Text3.Text = ""Close #1End Sub
Writing Code
Is there anyone out there that can give me the names of any VB sites or books that concentrate only in writing VB code.
I have plenty of books on VB, but they don't explain the logical way of writing code.
What I mean is, if I go through these books word for word and do every example, it don't make me a programmer as I don't know how to write code properly.
Thanks in advance.
Writing Code
IS there a way to write this code in a shorter version doing the same thing?
Private Sub CmbStatus_Click()
TxtCompleted.Text = CmbStatus.Text
If CmbStatus.Text = "On Hold" Then
TxtCompleted.Text = "50"
End If
If CmbStatus.Text = "Not Started" Then
TxtCompleted.Text = "0"
End If
If CmbStatus.Text = "Completed" Then
TxtCompleted.Text = "100"
End If
If CmbStatus.Text = "In Progress" Then
TxtCompleted.Text = "25"
End If
If CmbStatus.Text = "Rejected" Then
TxtCompleted.Text = "0"
End If
If CmbStatus.Text = "Ready For Production" Then
TxtCompleted.Text = "100"
End If
End Sub
Writing A Code
I need some assistant in writing a code for liters and pints and liter and gallon
Writing Code In EVB
Dear all,
Do anyone know if we can write codes of creating label by ourselves instead of draging it from the toolbar?? If yes, can u post any examples?
thx.
Problem With Writing My Code.
I tried this code but didn't succeed with me this code is to arrange the items in the columns 1,2,7,8.9.10 on condition that match in 4 columns 3,4,5,6.
Example: I set in the textbox the item that belong to the columns 3,4,5,6. (K,D,D,K). So the code must copy the item in columns 1,2,7,8.9.10 in three rows ( that contain these item K,D,D,K) as ite show in the end of the pic ( I signed by "Arrangement"). I hope I'm clear.
Code:
Dim MyRange1 As Range
Dim cell As Range
Dim i As Long
Set MyRange1 = Sheets(1).Range("C1")
For i = 1 To UsedRange.Rows.Count
For Each cell In MyRange1
If cell.Value = TextBox1.Text And cell.Offset(0, 1).Value = TextBox2.Text _
And cell.Offset(0, 2).Value = TextBox3.Text And cell.Offset(0, 3).Value = TextBox4.Text Then
Cells(i, 12).Value = cell.Offset(i, -2).Value
Cells(i, 13).Value = cell.Offset(i, -1).Value
Cells(i, 14).Value = cell.Offset(i, 7).Value
Cells(i, 15).Value = cell.Offset(i, 8).Value
Cells(i, 16).Value = cell.Offset(i, 9).Value
Cells(i, 17).Value = cell.Offset(i, 10).Value
End If
Next cell
Next i
Writing Test Code -- How And Why?
Hello,
I've been thinking for a while now if it's worth writing test code for small applications. I code my own complex macros with GUI that I plan to make them available to other people.
I'm now testing one of them manually and can't figure out how I'd do it through code.
How does one write code to test an application and is it worth the trouble?
Regards,
Guillermo
Programatically Writing Code
After some frustrating time on this problem I have at long last declared myself stuck. Any ideas on how to do this would be greatly appreciated!
The issue is this: I need to write a macro in an existing workbook that will itself write code in a designated, newly created workbook. Specifically the code to be inserted is a Workbook_SheetSelectionChange event handler that needs to be inserted into these newly created workbooks.
Again, many thanks if you have any ideas!
Chris
Writing Code At Runtime
The challenge that I have is that I have to generate code at runtime this means that the user will push some buttons and these will generate code which will be run at the moment the user wishes to run this code.
How can I do this?????
HELP!!!
Writing Code Dynamicly
The problem I have is that on school my teacher asked me to build an application which creates text automaticly. how is this?
Well, on an enterprise some of the text generated may be a consecuence of a data, like if the DOW JONES index increase then the text will be "The dow jones index increases a quantity of" etc.
Well my application has to be capable of accepting a user to crear his own forms to automatize the text he wants and capable of running this form which will ask the user for the text it needs to build the automatized text.
I was thinking of making a module which reads the actions of the user while he creates the form and then writing some code which will be run when he wishes tu run the form he just created.
My question is How can I dynamicly write code ???
Writing VB Code For WIn CE Pocket PC
I have VB 6.0, will upgrading to Visual Net allow me to program in Visual Basic for the Win CE platform or do I have to get the CE Toolkit for VB 6.0?
Difficulty With Writing A VB Code
I'm just a beginner with VB and our teacher had already given us a big project to work on. I'm having difficulty writing a program that would accept an input for your birthday (month, year) and tell you your zodiac sign.
Writing Code In Colour
I have Vb6 installed and I am interested in writing the code in colour. I have tried using Tools -> Options -> Editor Format -> Normal Text and changed the colour in the foreground window but the colour of the text does not change. Only the .(dot) changes to the chosen colour.
2. What should I do??
Learning Writing Code In Vb
how to write code of instal sheild of the programe?
how to design data base and conect to vb?
how to write code of utilites progrme?
how to decide which files you need in the programe;where in the programe have many file extension?
my E-mail:salahkasem@hotmail.com
Writing Code In OCX In Navision
Hi, does anyone know how to write the program code in RDC(Report Designer Component) which is the present ocx in Navision so as to integrate between Navsion Attain and Crystal Report 9.
Thanks alot
Writing Secure Code In VB 6
I recently wrote an simple app and sent it to some of my friends. One of my friends said that his antivirus software blocked the code. How can I write my code so that it's secure? Are there any tools available that can help with this?
Dre---
Help Me Writing Checkbook Code
please guys help me writing my project...this project is for my school..here is the link of the project...
http://staffwww.fullcoll.edu/jcourc...kbook/check.htm
Writing Source Code
How to develope a card reader application that is able to read card data and Store card data (Bar code card reader)using VB?
Reading Few, Writing One: Short Code
Hello programming community,
My experience here has been wonderful, but I do have one last question! FYI: Using Visual Basic 6.3 and reading from a file, then writing to a different file.
Here is what the comma delimited input file looks like:
...
L0G1W0,35200824,0.00202164486,0
L0H1G0,35190765,0.11641453567,0
L0H1G0,35190766,0.06262106163,0
L0H1G0,35190766,0.09166227313,0
L0H1G0,35190766,0.02116824894,0
...
(I've shaded the lines that are of interest)
First field is a Canadian postal code, second one is the ID it belongs to, third one is its area in km^2 and last one is population. As you can see, the lines in Dark Red all start with the same postal code (L0H1G0) and all belong to the same areaID (35190766). But they have different area in km^2.
Now, here is what I need to do: when I encounter such identical entries, I need to select the one with the largest area in km^2 (in this instance the one in bold, since it has the largest value)" and write that one to my new file. The remaining L0H1G0 records I will not write and simply go over them.
The following code correctly writes to new file (Thanks Roger_Wgnr!), but does not do what I need to! What do I have to change to do what it want it to?
Thanks a lot,
Sasha
vb Code:
Public Sub fiftyPercentRule()
Dim strText(3) As Variant, strTextInternal(3) As Variant
Dim strTextTempPC As Variant
Dim strTextTempDA As Variant
Dim strInput As Variant, strInputInternal As Variant
Dim tempMaxValue As Variant
Dim skipIterationFlag As Boolean
Dim i As Integer
'Creating FreeFiles
Dim IPF As Integer
Dim OPF As Integer
OPF = FreeFile()
Open "c:datasecondfile.txt" For Output As #OPF
IPF = FreeFile()
Open "c:dataobo.txt" For Input As #IPF
Do While Not EOF(IPF)
'Inputs one file record into strText array
For i = 0 To 3 Step 1
Input #IPF, strText(i)
Next i
skipIterationFlag = False 'I must use this since CONTINUE not avail in VB6
If strTextTempPC = strText(0) And strTextTempDA = strText(1) Then
skipIterationFlag = True
tempMaxValue = strText(2)
End If
strTextTempPC = strText(0)
srtTextTempDA = strText(1)
If skipIterationFlag = False Then
For i = 0 To 3 Step 1
Write #OPF, strText(i),
If i = 3 Then
Write #OPF, vbNewLine
End If
Next i
tempMaxValue = 99999
continueFlag = False
End If
Loop
Close #IPF
Close #OPF
End Sub
Writing In A Multiline Textbox By Code
I'm trying to write by code two lines of text in a multiline textbox but i only get the last line displayed.
Is this the right way?
textbox.text = "This is line 1" & chr(13)
textbox.text = "This is line 2" & chr(13)
Writing In Text File With Code...
I'm trying to do an text editor (some people knows that)
I can read it... But I can't save the work... Don't tell me to use rich text box. I'm want to do an editor BY MY SELF... How can I do it? How can I save it? I use the same function in the template of vb. It calls Tip of Day (surely you know that in vb 6.0) . I use that functions in that template...
Help Needed Asap In Writing A Code
HI I REALLY REALLY NEED SOM HELP ON FIGURING OUT HOW TO WRITE SOME CODES IM REALLY CONFUSED AND THE BOOK IS NOT HELPING HERE ARE THE CODES ANY HELP IS GREATLY APPRECIATED .
From the letter grades and credit hours given for each class, the program calculates GPA Points. GPA Points are the result of multiplying the number of credit hours earned from a class by the number of grade points earned in a class. Grade points are awarded based upon the letter grade received in a course according to the following rules: A = 4.0 pts, B+ = 3.5 pts, B = 3.0 pts, C+ = 2.5 pts, C = 2.0 pts, D+ = 1.5 pts, D = 1.0 pts, F = 0.0 pts. For example, a C+ in a three credit-hour course is worth 7.5 grade points. An A- in a one credit-hour course is worth 3.5 grade points. The program will calculate the GPA point total for each course listed by the user and display them with exactly one decimal place in the "GPA Pts" column of the GPA Report.
The total GPA Points earned in the previous semester are calculated by taking the sum of the values entered under the "GPA Pts" column of the GPA Report. This value is displayed with exactly one decimal place under the "Semester Summary" section of the GPA Report.
The student's semester GPA is calculated by taking the total semester GPA Pts and dividing them by the total semester credit hours. The resulting value is displayed with exactly two decimal places in the "Semester Summary" section of the GPA Report.
Finally, the student's new overall GPA is calculated by taking the student's total cumulative GPA Pts and dividing them by the student's total credit hours. We've already calculated and displayed the student's total credit hours (see bullet #2 above). To find his/her total GPA points, we need to take the cumulative GPA the user entered in the "Cumulative GPA" text box in the "Background" group box, multiply it by the value in the "Credit Hours" text box in the "Background" group box, and add it to the GPA points displayed under "Semester Summary" (see bullet #9 above). The formula looks like this: overallGPAPoints = (cumulativeGPA * overallCreditHrs) + semesterGPAPoints. Once the overall GPA points are calculated, divide this value by the total credit hours--the result is the cumulative GPA, which should be displayed with exactly two decimal places in the GPA Report.
Writing Several Code Statements In One Line
Dear Friends
How can I write codes written in several lines into a single line; for example
if some part of code statements is as
x(1)="David, Manchester"
x(2)="John, Sydney"
x(3)="Mary, Washington"
.
.
.
then I want to have it as the following:
x(1)="David, Manchester"; x(2)="John, Sydney"; x(3)="Mary, Washington" ; ...
which character do I use instead of ";" so that I can write the code in one singular line (in order to save space);
Thank you.
Writing Code To Multiple Lines
hi, this is a VERY N00B question, and I'm SURE its answered everywhere, but I can't seem to find the right wording to make the search find it...
how do i write my code so that it can be written on multiple lines, for ease of use in the future...
so, instead of coding
MsgBox "blah di blah...... (times 5000 characters)",
it will be something like
MsgBox "blah di blah.... (times 50 characters)",
(next fifty characters)
next fifty...
I'm not talking about the actual display of text, just my coding syntax...
I thought it was something like
CODE &_
CODE ...
but i'm drawing a blank
Writing Form Code In Runtime
hi,
i have created a form in run time and placed some controls. my program needs to write some specific code based on the requirement as gathered from user input.
How do i enter those codes in a form while running .
sunu
Helping A Begginer 4 Writing A Code
I want to write a code which is my assignment for my studies in VB. Actually the code is about supermarket and indicate to the folowing;
a)Selecting a department and loading the list of items.
b)Selecting an items and addiing it to the invoice.
c)Numbering items in the invoice.
d) Calculating total.
e) Adding item to the stock. from the add new item bottom it has to goes to the selected department and it shouldn't mix the item with other departement.
Here's the image of the form;
Could some one teach me how to do it and understand it very well from the experts members around here ??
Thanx in advance for helping me, as I'm a bit weak in VB
habibalby
Writing Code In DLLs***resloved***
I have a program that after compiling get's up to 2.5 MB now I wanna add some functions wich I may want to change with the time.
now instead of compiling the whole program an othe time I thought of making a DLL wich includes this functions but I have no Idea how to make it.
please help me.
Need Help Writing VBA Code For A Access Project
I am working on a database project that needs to utilize date comparison code. I could really use some help on this one. Heres the problem below..
Problem:
I need to construct code that compares data in three fields: Assets, StartDate, and EndDate. I have a database that I want to be able to schedule the use of assets for customers from a start date to and end date. Once an asset is scheduled for a customer from the start date, it cannot be used for another customer until after the end date. If an asset is already scheduled, then an error message box will appear on my form, or if the end date is before the start date an error message box will appear.(Sort of like Library Book code that allows the check out and return date of a book where no one else can check the book out until it is returned by the customer) If there is anyone out there who knows of code that I can use to program a form button on my Access 2003 database project please help. I have tried to write it out below in this form:
On Click
1.Opens qryScheduledResourceType
2.Compares Resource Type with StartDate and EndDate.
3. If there is no conflict with the Resource Type and dates, Then a new record
Will be saved.
4. If not, an error message will occur because either resources are already scheduled with the new dates or the end date preceeds the startdate.
I have started to try to write code for this, however I know that I am missing quite a few pieces:
Private Sub CommandSave_Click()
DoCmd.OpenQuery qryScheduleResourceType, acPreview
If ResourceType = 0 Then
Perform Save Function
ElseIf ResourceType > 0, Where StartDate (New) = between StartDate (Old) and EndDate (Old)Then
MsgBox "Scheduling Error-Resource Type Already Scheduled. Pick Another Resource Type or other Dates"
ElseIf EndDate < StartDate Then
MsgBox "End Date Error - End Date Occurs Before Start Date"
End If
End Function
I know this is crude, but it is the only way that I can come up with to explain this. I wish to tie this code, if possible to a Save record button on my form that will run this test, and either input the new record, or will produce an error message telling the customer to reschedule either another asset or dates. If you know how I can do this, I would really appreciate the help. I can be reached by reply to this email or the mail and phone number address below.
Thanks in advance.
James Jackson
813-828-4628
jacksj1@socom.mil
Understanding Exactly How To Start Writing Code
Am completely new to VB.net and I'm enjoying, learning how to use it, i.e. using Solution Explorer, making up the form using the controls, etc. However, my one BIG DRAWBACK is I just can't grasp how to starting writing code. Its like my mind goes blank when I think about the fact that I have to write code in order to completely learn this program. Can anyone help - please start with the very basic! Thanks!
Help Whith Excel Code Writing
I know that there is a way that I can make a employee time clock for employee in excel. If anyone can come up with a way to use the =NOW() to clock in and out, but how to tell excel to recognize employee passwords and automatically clock them in and out? Can anyone help me with this? Thanks
Mark
Help Writing Simple Recursive Code In BASIC?
I am looking for a minute of help writing a very simple piece of recursive code in BASIC. The problem is a classic textbook example.
ID, ParentID
A, -
1, A
2, A
i, 2
ii, 2
3, A
B, -
From the data table above, I need to produce this output as a text string in this format:
(A(1,2(i,ii),3),B)
The problem needs to be solved recursively because the sample data I posted above can go many levels deep.
I know that the main function should be "GetChildren" and that if the retrieved children have children, then that same function should be called.
The question I have is how does the output of each function get concatenated together? Someone told me a text stream needs to be used, but I don't understand exactly.
Feel free, of course, to save time by writing the solution in pseudocode.
Thanks in advance!
I Tried Writing The Code To Print The Same Pic Multiple Times But Still Cannot...HELP
There is a ImageBox() array. A CheckBox() array. A UpDown() Control array to increment or decrement the numbers in the TextBox().
Wat im trying to do is if i want to print five copies of the same picture in ImageBox(2) for example. i will click the arrow "Up" button of the UpDown(2) control until it changes the number in TextBox(2) from 1 to 5. Then i click a button to print. Apparantly, the code below works for printing single copy of the picture. But when i add in a FOR Loop to send the same print-job of a picture multiple times, it didnt work. Can anyone help me wif this? Thanxs
Below is my little code.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim Pics, iCopies, Max As Integer
' Code to print the array here
For Pics = Image1.LBound To Image1.UBound
' If the picture is not empty & checkBox is not checked
If Image1(Pics).Picture > 0 And Pass_Checkbox(Pics).value = Unchecked Then
' get the number of copies that the user wants to print
Max = Copies_UpDown(Pics).value
For iCopies = 1 To Max Step 1
Printer.PaintPicture Image1(Pics).Picture, 0, 0
Printer.EndDoc
Next iCopies
End If
Next
`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*RESOLVED* Writing Code For Events In A Reference
I'm including the Winsock DLL as a REFERENCE in a project of mine and I can't seem to figure out how to put code into its events (primaraly its DataArrival event). I'm declaring the DLL as mySock.
Any help would be much appreciated,
cjqp
Writing A VB Code To Talk With The Comm Port
Im very new to writing in VB but I need to find out how to write a program the will allow a VB written program communicate with a comm port (which is connected to a Scorbot_ER III manipulator).
I am in desperate need for a project I am doing can anyone help?
Thanks
My Second Day Learning VBA. I Have Two Questions About Writing Code For Excel
Hi,
Excuse my lack of knowledge but I guess that's why we're all here....
I'm trying to get a hold on VBA as quickly as possible. I'm working my way through a textbook trying to pick it up as quickly as possible and I've got two minor questions/problems....
1. I'm trying to add an average at the end of a table of data. I've created "FinalRow" to workout the last row of data. I then want to add an average in column D on the TotalRow line.
I've created the following code. When I run it the field which should contain the average value simply says "false". What am I doing wrong?
Code:
FinalRow = Range("A65536").End(xlUp).Row
TotalRow = FinalRow + 1
Range("A" & TotalRow).Value = "Average"
Range("D" & TotalRow).Select
FormulaR1C1 = "=Average(R2C:R-1)C)"
Selection = NumberFormat = "0.0"
_____________________________________________________________________
2. Within my table of data I have a column (D) that contains a value between one and ten. When the field contains "0" I want to enter in the same row, cell E the word "Low". When the field contains "10" I want to enter "High".
I understand how to apply one variable (say "low") in the right cell on the condition that I give the specific range of the column D (say D1100). However, what I can't do is to produce "low" or "high" depending on which of the criteria it meets.
I also don't want to have to say the exact cell range as the table has new entries added to it each day and will be a different number of rows each time.
What I'd like to do is as cell “D1:FinalRow”. But when I write the code for the this of this it produces an error.
My code for this is:
Code:
Set rng = Range("D" & FinalRow).Find(What:="0", Lookat:=x1Whole, LookIn:=x1Values)
rng.Offset(, 1).Value = "Low"
_____________________________________________________________________
Thank you in advance for any help you can give me!
Edited by - Geof on 6/3/2006 1:13:47 PM
Updating A Recordset In A Child Form Without Re-writing All The Code
Hello again,
I am just wondering if I have a command like this.....:
rsChild1.Open strSQL, cnChild1, adOpenStatic, adLockReadOnly
......when I open a child form and load records into it but when I move to another record in the parent form I want to update the record in the child form without having to go through all the .open lines for the connection and recordset and sql statements, can I do this. I tried doing a:
rsChild.update
But it gave me some run-time 3251 error saying it cannot be updated. Then I realized that I didnt want to change the data so update is not what I want. But I cannot find any properties or methods that go with teh recordset that will update my sql statement automatically so new records appear.
thanks
Writing One Code For Running All The Events Of The Subitems In A Menu
My question is if it is possible to write a code for more than one event. My menu has a lot of subitems and so it is not possible to have one control array.
Is it possible to run one code when any of the subitems in the menu is clicked?
For example:
oneofmenuSubitems_click()
Can somebody help me
How Do You Code In Visual Basic Writing To An Access Database?
I currently am writing information captured on a form to
a text file which I am importing into Access with VB. I now want to write the information directly to access. What are the steps invloved in doing so. Anyone's help would be
greatly appreciated!!!
Thanks,
Bill
b.ward@vanderbilt.edu
|