Hi guys,
I am actually trying to find codes to add data in a datagrid on VB6 using Access. I have 2 forms that I created, one has the datagrid and the second has 2 textbox and the ADD button,I want data in the first form to be added to the datagrid in the second form, i am using ADO.
Please help guys????
↧
How to Add data in datagrid using vb6 and access DB
↧
Datafield SrNo Not Foud
Code:
---------
Dim SrNo As Boolean
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdPrint_Click()
Set Record = New ADODB.Recordset
Record.Open "SELECT InvoiceNo,Qty,Price,TotalAmount,DateCreated,CustomerName,ProductCode,ContactNo,Address,City,Tin,Dist,Packing,(SELECT COUNT(*) FROM SalesInvoice C2 WHERE C2.ProductCode <= C.ProductCode) AS SrNo FROM SalesInvoice C ORDER BY ProductCode ", Connect, 1, 3
If Record.RecordCount > 0 Then
With rptSalesInvoice
Set rptSalesInvoice.DataSource = Record
.Sections("Section4").Controls("Label17").Caption = Record!DateCreated
.Sections("Section4").Controls("Label18").Caption = Record!InvoiceNo
.Sections("Section4").Controls("Label19").Caption = Record!CustomerName
.Sections("Section4").Controls("Label28").Caption = Record!Address
.Sections("Section4").Controls("Label29").Caption = Record!City
.Sections("Section4").Controls("Label31").Caption = Record!ContactNo
.Sections("Section4").Controls("Label33").Caption = Record!Tin
.Show 1
Set Record = Nothing
End With
Exit Sub
End If
End Sub
---------
Count is not starting from 1,2, it shows record count as in database
↧
↧
Visual Basic has stopped working while generating exe
My project is running fine, but while i am trying to generate exe file, it compiles and while it's writing exe, I gets the same error and shuting the IDE. Please help...
↧
Date Picker Error after Creators Update ?
I have been compiling a biorhythm program over the years and now I am unable to open it in VB6
I understand it could have been something to do with the Creators Update in Win10
I looked in the Error Log and it said
---Quote---
Line 731: Class MSComCtl2.DTPicker of control DTPicker1 was not a loaded control class.
Line 752: Class MSComCtl2.DTPicker of control DTPicker2 was not a loaded control class.
---End Quote---
Help!
↧
[RESOLVED] Date Picker Error after Creators Update ?
I have been compiling a biorhythm program over the years and now I am unable to open it in VB6
I understand it could have been something to do with the Creators Update in Win10
I looked in the Error Log and it said
---Quote---
Line 731: Class MSComCtl2.DTPicker of control DTPicker1 was not a loaded control class.
Line 752: Class MSComCtl2.DTPicker of control DTPicker2 was not a loaded control class.
---End Quote---
Help!
↧
↧
Save from .xml to .txt
I have a xml-file (attached).
From this file I want to read all the content from ' which appears 1 or more times in that file,
and then I want sa save these child items to a .txt file.
Can that be done or do I need Treeview?
I am not know with xml.
↧
Help with VB6 refreshing ADODC problem
I have 2 program, very simple VB6 program to add data into ms-access(.mdb) and the other program is just viewing the data.
Program A run on PC-1 and Program B run on PC-2
1. Program A
Attachment 34949 (http://forums.codeguru.com/attachment.php?attachmentid=34949)
Private Sub Command1_Click()
Adodc1.Recordset.Addnew
Adodc1.Recordset.Field(0) = Text1.Text
Adodc1.Recordset.Field(1) = Text2.Text
Adodc1.Recordset.Update
End SUb
(Program A is working OK, it just use to insert data into .mdb)
2. Program B
Attachment 34951 (http://forums.codeguru.com/attachment.php?attachmentid=34951)
It just datagrid to view data from ms-access. The data was input using Program A on PC-1.
(Program B is working properly to display data, but when I add data from Program A the data was not display last record that I've added)
My problem is when i add the data from Program1, Program2 is not display the data that I have just enter it. These 2 program are running together on each computer.
The datagrid can view my last data only if i close Program B and open it again. If i add command button on Program B to refresh adodc then the data is displayed.
But I need the adodc to automatically refresh when there is data change.
Help me pls
↧
UTF-8 To Base-64
I'm trying to convert a xml to byte array using ADO Stream object
and after that convert it to Base-64 using Chilkat to build a json request
The problem is the next:
---The original xml has: *
*When I convert the byte array back to UTF-8 to check the conversion, I get only
**
the same occurs with the Base-64 it doesn't has: *encoding="utf-8"
*
What I''m doing wrong?
Are there other ways to do it?
Thanks!
↧
VB6 v. VB.net
Could someone tell me exactly what is the difference in VB6 v. VB.Net?
↧
↧
[RESOLVED] VB6 v. VB.net
Could someone tell me exactly what is the difference in VB6 v. VB.Net?
↧
VB6 with Crystal Report 8.5 printing without view in default printer
I am using Crystal Report 8.5 in VB6 to Print Invoice .. I am developing this application for my customer. I wish to print invoice without view the report and it should directly print to printer without view in crviewer.
I dont know which printer customer is using. So, Thru coding I wish to print report customers default printer.
Here is my code. But no print out coming.
If I choose crystal report 8.5 right click =>Designer=>Printer setup and then select printer I will work.
No printer option is not displayed in printer setup dialog box.
Please give me option to print default known printer
my code:
BILLPRINT.PrinterSetup defaultprinter
BILLPRINT.PrintOut False
↧
Visual Basic Help
Hi Everyone,
Can someone please write the code I would need to do the following:
start in tab "Data"
start in row 3
go to column B (cell B3)
if B3 is blank, go to the next row column B
if column B is not blank(i.e. has an x or a date), go to column C (C3)
If column C is not blank (i.e. has something in it), go to next row column B
if column C is blank, go to column A and copy the value in the cell A3 and paste that value into tab "Form" cell O12
print the tab called "Form"
Go to row 4 or next row
repeat until row 350
The reasoning is, if have a value in column b, I have to print a form.
If I have a value in column c (like an x or a date), I already printed it.
If I don't have a value in column C, I need to print the form and check it off with an x in column c after I have the form in my hand.
The reason I put the value in cell A3 or A4 etc in the tab "Form" cell O12 is because I have the form set with vlookups to pull the relavant data relating to the form into the cells based on the "Data" tab.
The information of what would need to be printed each month would change. We might need to print the info related to row 3, 17, 22-40, 37 this month, but row 75, 3, 50- 70, and 230-270 next month so I don't want to record a macro that would print things not needed next month and not print things that need to be printed. This is to make this process at work easier for someone. I know there is a way to do this, but I don't know much about VB except that this logic can be meet somehow with this powerful program. I am not looking to learn how to program, just to help out a friend at work.
Any help would be greatly appriciated.
↧
ADO Recordset to XML in Crystal Reports
I'm using Crystal Reports based on ADO.NET(XML) connection.
I generate ADO Recordset in VB6 project, I save it like this:
Code:
---------
rsTemp.Save App.Path & "\LocalData\DailyTakeOff.xml", adPersistXML
---------
Then I use this code to display the report:
Code:
---------
strReportPath = App.Path & "\LocalData\MyReport.rpt"
Set varApp = New CRAXDRT.Application
Set varReport = varApp.OpenReport(strReportPath)
varReport.Database.Tables.Item(1).SetLogOnInfo "XML Data", "", "", ""
varReport.DiscardSavedData
varReport.Database.Tables.Item(1).SetLogOnInfo "XML Data", "", "", ""
varReport.Database.Tables.Item(1).Location = App.Path & "\LocalData\DailyTakeOff.xml"
---------
In some cases the recordset contains values in some fields less than 1. In my case it is 0.09. I see this value in the output of the SQL Server stored procedure. I see tha same value in the recordset. By some reason in the XML file I see that value as 8.9999999999999997E-2.
In Crystal Reports in order to format the field as number I use formula ToNumber({row.CombinedAverageMarkup})>0.
I get an error due to the fact that Crystal doesn't want to see the value containing E-2 as number.
A see most rounded in the recordset to 2 decimals presented as long long numbers. For instance:
52.270000000000003 instead of 52.27
56.109999999999999 instead of 56.11
and many others.
Any help please
↧
↧
Where are my programs?
I've written a few dozen programs in VB (Ver. 5.0). I presume they reside somewhere on the hard disk in my PC, but where are they? When I'm in the VB programming environment, I can access them to edit ("File" > "Open Project") and run. There, they have names like "breaker.vbp", "calcu.vbp", and "check.vbp". These look like file names to me, but when I ask Windows to find them ("Start" > "Start Search"), I always get "No items match your search". I want to "grab" them to migrate them to a new computer, but I can't find where they are located.
↧
Can VB be migrated?
I have VB5 on my old computer, duly licensed and registered.
I want to use it on my new computer.
I seem to have lost the original installation disk(s).
Using a thumb drive, I've copied-and-pasted what seem to be all the constituent files,
plus a downloaded copy of MSVBVM50.DLL, which the new setup couldn't find,
but now the message is "MSVBVM50.DLL could not be registered".
Is there a built-in restriction on migrating the program?
If so, is there anywhere on the Web where VB5 or VB6 can be downloaded for free?
↧
Conflicting names
I've written many successful programs in VB5 without understanding what's going on behind the scenes regarding file management.
When I boot up my current VB5 program to edit in the IDE, it tells me...
"Conflicting names were found in 'C:\Program Files\DevStudio\VB\ed1Rule..frm'.
The name 'frmEd1Rule' will be used."
That's not a typo: the filename "ed1Rule..frm" contains a double dot (maybe originally a typo on my part?).
I click "Okay", and everything runs fine after that.
But I would still like to eliminate the conflict.
In the IDE, the field at the upper right corner of the screen, labeled "Project - Project1", lists the six Forms of the program, each one first with a simple (no extension) name, and second, in parentheses, a _different_ name with the ".frm" extension. One of these six pairs of names matches the names in the "Conflicting names" message above:
"frmEd1Rule (ed1Rule..frm)"
(But there's no message for any of the other "mismatches".)
A separate curiosity:
In one of the names in parentheses, the part before the dot consists of a single _non-keyboard_ character, the phonetic symbol eth (ð).
Should I just be happy with the functioning program and not worry about these details, or can you advise me how to manage these names better?
↧
Getdefaultprinter problems
GetDefaultPrinter and SetDefaulPrinter Problem
I am having a problem with the above features in a vb6 program in Win10.
I am writing a program in which I switch kitchen printers in a a restaurant depending on what has ben ordered (pizza at 1, burgers to another, etc.)
When I try to switch printers using setdefaultprinter and getdefaultprinter these features do not work all the time. MS says there is a problem in previous versions such as win8 but since vb6 in win10 is not supported I am not sure what hotfix, if any, I should use.
The following is the area of the problem. The '<<<< lines are the problem
'This is printing for drinks
Dim oldPrinter As String
Printer.FontBold = True
Printer.FontSize = 14
If NumDrinks > 0 Then
GoSub Headingx
oldPrinter = GetDefaultPrinter '<<<<<<<<<<<<<<
SetDefaultPrinter DrinkOrderPrinter <<<<<<<<<<<<<<<<<<<
Printer.Print sServerName '( 'SERVERNUMBER)
For XXX = 1 To NumDrinks
Printer.Print PrintDrinkItems(XXX)
Next XXX
Printer.EndDoc
End If
'THIS IS FOR APPS ONLY PRINTING
If NumApps > 0 And NumMains = 0 Then
GoSub Headingx
oldPrinter = GetDefaultPrinter '<<<<<<<<<<<<<<<<<<<<<<<
SetDefaultPrinter FoodOrderPrinter '<<<<<<<<<<<<<<<<<<<<<<<<<
For XXX = 1 To NumPrintedItems
Printer.Print PrintItems(XXX)
Next XXX
Printer.EndDoc
End If
↧
↧
Getting ListBoxes to scroll in unison
In my VB5 program, ListBox A and ListBox B alongside it contain the same number of items, and it's too many to fit on the screen, so they both have a vertical scrollbar.
Actually, I hide B's scrollbar behind A, so only A's scrollbar is visible.
I want ListBox B to move in lockstep with ListBox A. And it does, just fine, when I use either A's scrollbar or the Up and Down keys on the keyboard. The "_Scroll" event does it for me as follows:
Code:
---------
Private Sub lstA_Scroll()
lstB.TopIndex = lstA.TopIndex
End Sub
---------
But ListBox A can also be scrolled by means of the wheel on the mouse, and I can't get B to scroll along with that. The best I can do is to use MouseMove as follows:
Code:
---------
Private Sub lstA_MouseMove()
lstB.TopIndex = lstA.TopIndex
End Sub
---------
The mouse wheel scrolls ListBox A alone, and then B twitches into place when the mouse moves. I would prefer they move in unison.
Other kinds of controls have a "_Change" event available, but evidently a ListBox does not. Is there some way I can get B to scroll when the mouse wheel scrolls A?
↧
How to assign function to keyboard function key in Visual Basic
Hi,
I'm trying to create a program in Visual Basic to assign a function key to print a screenshot of the current screen and another one to print a list of the files in the currently selected folder in File Explorer.
The key assignments need to remain active even after the program that assigns the keys has been closed.
Does anyone know how to do this?
Debbie
↧
Using Select Case to decide to choose from three differnt label formats
I originally used nested if then but was told to use Select Case.I am attaching my code. After executing this line, the next three lines are to save the varible data to a text file depending on with being "WATER", WATER WITH SALTS" or ELSE. it wrote variables specific to which one was indetified. I added the third save variable data statement specific to "WATER WITH SALTS". i'm novice at this and I can not figure out or see what tell it to write the related text file. "WATER" AND "ELSE" WORKS but "WATER WITH SALTS" does not write the file, I can send more of the program if needed. I've been on this for two days and about bald!
↧