Returning Records
I am using the folowing code to retrieve specific data from an SQL7 DB. If I run the same query copied and pasted from the code into the query analyzer it returns a record. When run in the code it returns nothing and a record count of -1.
Am I not doing something right here?
Code: Dim NewCon As ADODB.Connection Dim RS1 As New ADODB.Recordset
'Create New Connection Set NewCon = New ADODB.Connection
'Set Connection string and open connection With NewCon .ConnectionString = "Provider=SQLOLEDB;Data Source=localhost;" _ & "Initial Catalog=image;User Id=sa ;Password= ;" _ & "Connect Timeout=15;Network Library=dbmssocn;" .Open End With
SQL1 = "SELECT * FROM STORE WHERE INDEX1 = '12345'"
RS1.Open SQL1, NewCon
MsgBox RS1.RecordCount
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Recordset Only Returning Five Records When It Should Be Returning 466
All,
Doing this in excel with VBA. Haven't working in VBA for a very long time but can't see why I'm getting these results.
I run this sql in query analizer and I get 466 records back but when the same sql runs in vba I only get five records back. I checked the conn string to make sure I was running against the correct db. Is it that I'm not setting up my recordset object correctly?
Code:
Set conSql = New ADODB.Connection
conSql.Provider = "SQLOLEDB"
conSql.ConnectionString = "Data Source = Test1;" & "User ID=sa;Password=test; Initial Catalog = test;"
'conSql.ConnectionTimeout = 120
conSql.Open
Dim strSql As String
Dim fldField As ADODB.Field
Dim docXML As New MSXML2.DOMDocument
Set rstData = New ADODB.Recordset
strSql = "SELECT CedingCoID, effectivedate, XMLString " & _
"FROM CAPSProgram " & _
"Where ID > 1 and CedingCoID > 1" _
' "WHERE (CedingCoID = '" & intCedingCoID & "' AND EffectiveDate = '" & CDate(datEffectiveDate) & "' AND Description " & IIf(strDescription = vbNullString, "IS NULL)", " = '" & strDescription & "')")
rstData.Open strSql, conSql, adOpenForwardOnly, adLockReadOnly
'Set rstData = conSql.Execute(strSql)
Do Until rstData.EOF
' If Not rstData.EOF Then
globEffectiveDate = rstData.Fields("effectivedate").Value 'set global effective date for future use
docXML.LoadXML (rstData.Fields("XMLString").Value) 'load glabal xmldoc for all load routines
globCedingCoID = rstData.Fields("CedingCoID").Value
Call LoadCapsProgram(docXML)
Call LoadCapsLossHisEvents(docXML)
'End If
rstData.MoveNext
Loop
Not Returning Records
Hi,
I run an sql statement designed to return records based on dates
strSELECT = "SELECT ID, Name, Number, LastAccess FROM UA#BatchReport WHERE LastAccess BETWEEN '" & StartDate & "' AND '" & EndDate & "';"
Adodc1.RecordSource = strSELECT
Adodc1.Refresh
DataGrid1.Refresh
However this is not returning any records, it should - the info is there in the tables, I have tried it in the SQL server and got the proper result - so I can only think that there is something wrong in the code but I cant see it
If anyone else can I would appreciate any help
SQL Not Returning All Records
Hi All,
I am using the following code to extract records from a paradox database. The problem I am having is that not all the expected records are returned. I use the same code but for a single day in a different program and it works fine.
' Read through the Product day file for the current shop for the selected day
' and accummulate the number of products sold and their value
sqlProdDay = "Select QTY, [Value] FROM ProductDay.db WHERE LocationNo = " & intLocNo & " AND SalesDate Between " & "#" & dteFrmDate & "#" & " And " & "#" & dteToDate & "#" & ""
'Debug.Print sqlProdDay
Set rsProdDayRS = dbSamDB.OpenRecordset(sqlProdDay, dbOpenDynaset)
Do While Not rsProdDayRS.EOF
intProdSold = intProdSold + rsProdDayRS!QTY
curProdSoldVal = curProdSoldVal + rsProdDayRS![Value]
rsProdDayRS.MoveNext
Loop
'End of productDay Records for current Location so clear for next
Set rsProdDayRS = Nothing
Please point me in the right direction
Many Thanks
Bigfella
Returning Multple Records From One Key.
I have a sql DB with data in the following format:
IncidentNumber CAN Description
10 1 test1
10 2 test2
9 1 another test
I have produced the following code:
Sub inquireca1()
Dim c As New ADODB.Connection
c.Open "DSN=incidentreporting;UID=incident;PWD=incident;OLE DB_
Services=-1"
Dim rstCorrAct As ADODB.Recordset
Set rstCorrAct = New ADODB.Recordset
rstCorrAct.Open "SELECT * FROM Data_Corrective Where _
Data_Corrective.IncidentNumber = " & _
frmInquire.IncidentNumTB.Text, c
If rstCorrAct.EOF = False Then
If CorrectiveAction.CAN1 = 1 Then
CorrectiveAction.Desc1 = rstCorrAct!Description
Else
End If
If CorrectiveAction.CAN2 = 2 Then
CorrectiveAction.Desc2 = rstCorrAct!Description
Else
End If
End If
rstCorrAct.Close
End Sub
The intent is to find all records with an incident number equal to 10 and then populate those records into specific fields on a user form based upon their CAN number. However what actually occurs is that the result for incident numbere =10 and CAN = 1 is showing up in both Desc1 and Desc2 fields. In other words, the result so test1 shows in both fields instead of test1 and test2 respectively.
What am I missing? What modification is required to placed the correct values in the correct field?
Thanks for your help.
Returning Random Records Using DAO
I'm trying to pull 100 random records from a table of 1000 (Access) using DAO. I can get it to work in Access using a funcion call within the SQL statement but it wont work in VB6. I get a function undefined error. Any suggestions ?
Returning Matching Records
Hi I have a small database in my office and there are some mistakes being made in the patient registration table, the girl that works here is putting in duplicate patients in the table. The key field is just an auto number (patient ID) we have a field for the soc number but cannot use that as the key because we do not keep a soc for all patients. What I would like to do is on the after update event on the SSN check and see if that number is in the database and if it is come back with a msgbox, but also if there is no SSN on the click of the enter patient I would like it to check the last name and first name to see if there are any matching records for those and return the results if any. Can anyone help with the best way to accomplish this? Thank you in advance Pam
Unique Problem Returning Records; Please Help
Brief layout of my small program:
Form1 = Search for and select a Part Number. (Using Simple ComboBox)
Upon clicking desired Part Number, Form2 opens with Part Number's subcomponents returned in textboxs. Each subcomponent has a CommandButton the user can click to spawn another Form that correlates to the Text in the subcomponent textbox. This Form shows specific details about the subcomponent selected.
When I run the program in Visual Studio everything seems to flow well until Form2 (Subcomponent). If I click the CommandButton for one subcomponent the new Form displays the information correctly. However, when I close the Form (Subcomponent Detail) and return to the previous Form (Subcomponent List) and select another subcomponent the new Form just returns the first record in the recordset.
Added Note: Just for simplicity and troubleshooting; I assigned each record request their own database and table. These are all identical except the name. Also each subcomponent has it's own Form.
For the subcomponents I use an SQL filter statement to return a specific record in the table.
I use the same query everytime; except the query references it's own unique database. The database is Access 2007.
Everything in the code say's it should work, but I still only get one query returned correctly.
Code:
'SELECTING PART NUMBER (FORM1)
Private Sub dcmbFPN_Click(Area As Integer)
frmSubAssy.Show
frmSubAssy.txtSelectedFPN.Text = dcmbFPN.Text
Unload Me
End Sub
'No SQL Filter on this Form
--------------------------------------
'SELECTING SUBCOMPONENT (FORM2)
Private Sub cmdShowDetail1_Click()
frmCoreDetails.Show
frmCoreDetails.txtCPN.Text = txtFPN(3).Text
Me.Hide
End Sub
'CORRESPONDING SQL FILTER
'This executes on frmCoreDetails.Show
Private Sub txtSelectedFPN_Change()
Dim rs As New ADODB.Recordset
Dim R As String
R = txtSelectedFPN.Text
If Connect() Then
rs.Source = "Select * From FULLSUBLIST Where PARTNUMBER = " & "'" & R & "'"
rs.Open rs.Source, goConn, adOpenForwardOnly, adLockPessimistic
If Not rs.EOF Then
Set txtFPN(3).DataSource = rs
txtFPN(3).DataField = "SA1"
Set txtFPN(1).DataSource = rs
txtFPN(1).DataField = "PARTNUMBER"
Set txtFPN(2).DataSource = rs
txtFPN(2).DataField = "REVISION"
Set txtFPN(4).DataSource = rs
txtFPN(4).DataField = "SA2"
Set txtFPN(5).DataSource = rs
txtFPN(5).DataField = "SA3"
Set txtFPN(6).DataSource = rs
txtFPN(6).DataField = "SA4"
Set txtFPN(7).DataSource = rs
txtFPN(7).DataField = "SA5"
Set txtFPN(8).DataSource = rs
txtFPN(8).DataField = "SA6"
Set txtFPN(9).DataSource = rs
txtFPN(9).DataField = "SA7"
Set txtFPN(10).DataSource = rs
txtFPN(10).DataField = "SA8"
End If
rs.Close
Else
MsgBox "Houston...we have a problem...no records.", vbInformation, "No Records"
End If
End Sub
'CORRESPONDING CONNECTION (goConn)
Option Explicit
Public goConn As ADODB.Connection
Public bConnectedFlag As Boolean
Public Function Connect() As Boolean
On Error GoTo errConnect
'don't reconnect unless there isn't a connection already
If Not bConnectedFlag Then
'setup a connection & connect
Set goConn = New ADODB.Connection
goConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Documents and SettingsPeaceDawgDesktopNew VB Folder3Purchasing Database_Rev3.mdb;"
goConn.Open
bConnectedFlag = True
End If
Connect = True
Exit Function
errConnect:
MsgBox Err.Description
End Function
'CLOSE
Private Sub cmdClose_Click()
Unload Me
frmSubAssy.Show
End Sub
----------------------------------------------
'SELECTING ANOTHER SUBCOMPONENT (FORM2)
Private Sub cmdShowDetail2_Click()
frmHeaderDetails.Show
frmHeaderDetails.txtHPN.Text = txtFPN(4).Text
Me.Hide
End Sub
'CORRESPONDING SQL FILTER
'This executes on frmHeaderDetails.Show
Private Sub txtHPN_Change()
Dim rs As New ADODB.Recordset
Dim R As String
R = txtHPN.Text
If Connect4() Then
rs.Source = "Select * From HEADERS Where PARTNUMBER = " & "'" & R & "'"
rs.Open rs.Source, goConn4, adOpenForwardOnly, adLockPessimistic
If Not rs.EOF Then
Set txtHD(0).DataSource = rs
txtHD(0).DataField = "PARTNUMBER"
Set txtHD(1).DataSource = rs
txtHD(1).DataField = "PARTNAME"
Set txtHD(2).DataSource = rs
txtHD(2).DataField = "DESCRIPTION"
Set txtHD(3).DataSource = rs
txtHD(3).DataField = "MFGNUMBER"
Set txtHD(4).DataSource = rs
txtHD(4).DataField = "ONHAND"
Set txtHD(5).DataSource = rs
txtHD(5).DataField = "ONORDER"
Set txtHD(6).DataSource = rs
txtHD(6).DataField = "BASEPRICE"
Set txtHD(7).DataSource = rs
txtHD(7).DataField = "UNITPRICE"
Set txtHD(8).DataSource = rs
txtHD(8).DataField = "LASTPRICE"
Set txtHD(9).DataSource = rs
txtHD(9).DataField = "UOM"
Set txtHD(10).DataSource = rs
txtHD(10).DataField = "REORDERPOINT"
Set txtHD(11).DataSource = rs
txtHD(11).DataField = "MINORDER"
Set txtHD(12).DataSource = rs
txtHD(12).DataField = "LEADTIME"
Set txtHD(13).DataSource = rs
txtHD(13).DataField = "LASTORDERDATE"
Set txtHD(14).DataSource = rs
txtHD(14).DataField = "VENDOR1"
Set txtHD(15).DataSource = rs
txtHD(15).DataField = "VENDOR2"
Set txtHD(16).DataSource = rs
txtHD(16).DataField = "VENDOR3"
End If
rs.Close
Else
MsgBox "Houston...we have a problem...no records.", vbInformation, "No Records"
End If
End Sub
'CORRESPONDING CONNECTION (goConn4)
Option Explicit
Public goConn4 As ADODB.Connection
Public bConnectedFlag As Boolean
Public Function Connect4() As Boolean
On Error GoTo errConnect
'don't reconnect unless there isn't a connection already
If Not bConnectedFlag Then
'setup a connection & connect
Set goConn4 = New ADODB.Connection
goConn4.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Documents and SettingsPeaceDawgDesktopNew VB Folder3Purchasing Database_Rev6.mdb;"
goConn4.Open
bConnectedFlag = True
End If
Connect4 = True
Exit Function
errConnect:
MsgBox Err.Description
End Function
'CLOSE
Private Sub cmdClose_Click()
Unload Me
frmSubAssy.Show
End Sub
----------------------------------------
'ETC, ETC, ETC...
I know it's a bit of code, but it will show the pattern and maybe shed some light to the problem. The database connection is ADODC. Form HeaderDetails returns the correct info where Form CoreDetails returns 1st record. It seems to jump over the condition If Not EOF. I tried with If the .text <> " ", however this returns blank textboxes.
I can email someone the program for further review if necessary.
Please someone help me troubleshoot this issue. I really need this for work.
Thanks in advance,
Peace_Dawg
ADO Not Returning Records Containing Null Values
The application is a classic ASP website which displays the box score from hockey games. The portion causing the problem is the scoring summary. On any given goal, there is always a goal scorer, with either 0, 1 or 2 assists. ADO is omitting records that do not have two assists.
I am returning an ADO recordset with records from a SQL Server database. The recordset is populated by calling a stored procedure. The ADO recordset is only returning records when there are 2 assists on a given goal. If there are 0 or 1 assists, the record is omitted from the recordset. There are no error messages being generated. When executing the stored procedure within SQL Server, it correctly returns the specified records. In other words, the issue is only occurring when the process runs through ADO. When the procedure is run in SQL Server, the fields where the assists should be are filled with NULL values as expected.
This is the line of code that opens the ADO Recordset
rsGoalsFirst.open "spSHSHLGetScoringByPeriod " & lintGameID & ", " & lintPeriod, cn, 1, 1
Both parameters are integers and they are being populated correctly.
Are there any known issues with ADO that I am not aware of? Has anyone ever seen anything similar to this occur in their applications?
betrl8thanever: Moved to VB & Databases forum
Edited by - betrl8thanever on 10/15/2007 4:40:48 PM
Returning The Index Number Of Records
Hello. I have been having a problem putting together a sub that would return the index number of a specific record so that i could use gotoRecord to make a form move to the requested record instead of filtering out all others presenting only the one that matches the criteria. I tried using absolutevalue but errors still come up... Any ideas for an easy implementation for this?
*** Resolved *** Trouble With My SQL Statement Not Returning All Data From Records
I am working with an Access database that has three tables. I have got my Select statement working great but I have found that I don't seem to be getting the primary keys from each of the tables. I get the primary key from my tblAppt but I don't get the secondary keys from this table and I don't get the primary keys from the other 2 tables. Here is my SQL statement:
Code:SELECT * FROM tblResident INNER JOIN (tblDoctor INNER JOIN tblAppt ON tblDoctor.Dr_ID = tblAppt.Dr_ID) ON tblResident.Resident_ID = tblAppt.Resident_ID ORDER BY Appointment_Date, Appointment_Time ASC
As you can see the tblAppt contains the primary keys from the other tables as secondary keys and yet when I try to display them in my extended listview control they aren't in the recordset. The statement I get is:
Quote:item cannot be found in the collection corresponding to...
Anyway if someone has a fix for this or a suggestion for me to try please let me know, Thanks.
Later,
Cliff R.
Mesa, AZ
Check out my website at http://crogers.org
Being an organ donor is giving the greatest gift that someone can give.
It is giving the gift of life. Please register to be an organ donor.
Edited by - crogers on 7/23/2005 10:00:18 PM
Returning "neighboring" Records?
How would I consturct an SQL statement that performs the following:
I would like to return the 5 "neighboring" records in a table based on the record id.
For example, say my table has the following records:
V101
V102
V105
V106
V210
V211
V215
V216
V218
W001
W003
W005
W009
W010
W011
W120
W130
X001
X020
If I were to use the record "W001" as my reference, how would I return the 5 records immediately before this record and the 5 records immediately after this record?
It's important to point out that the record ids are not necessarily in numeric sequence, as the example shows.
I know how I could get the 5 records before.. I could just use TOP 5 and a criteria of > "W001", but how would I also return the 5 after in the same sql statement?
Any help would be appreciated..
Dan
When I Select In Combo Related Records Display In Grid, Few Records Are Not Displaying
I think this is the right place to post this, without knowing i place this in other discussion.
I am new.
Actually my project's Purpose [in the Form1, two combo boxes listing ItemCode and Description from two tables, where ItemCode is equal in both tables, after selecting in combo, the related record displayed in the Form2-MSHflexgrid]
Everything is working perfectly except one thing. Only three records is not displaying the details among the 1600 records
OFFICE 2000 W32 EN INT'L
MONEY 2000 W32 ENG INT'L
COMPAQ PRESARIO MV500 15" MONITO . this 3 records are in the present in the table and the ItemCode is also equal. The 3 belongs to Description field. I check through in another way, by giving the Itemcode in the first combobox, it displays correctly the details of all records. where as in the second combobox only these three is strucking up.
where as PRESARIO MV500 15" MONITOR is also a record similar to the three records but it is displaying.
I don't know this is because of any string error or something else. What's the problem, Kindly reply me.
Form_Activate()
If Form1.optItemcode.Value = True Then
sqls= "selecttab1.Itemcode,tab1.Description,tab1.Product,tab2.warehouse,tab2.Qty,tab2.Amt,tab2.Amt * 5/100 from tab1,tab2 where tab1.Itemcode=tab2.Itemcode AND tab1.Itemcode='" & Form1.cmbItemCode.Text & "'"
End If
If Form1.optDesc.Value = True Then
sqls="select tab1.Itemcode,tab1.Description,tab1.Product,tab2.warehouse,tab2.Qty,
tab2.Amt,tab2.Amt * 5/100 from tab1,tab2 where tab1.Itemcode=tab2.Itemcode AND tab2.Description='" & Form1.cmbDescription.Text & "'"
End If
rst.Open sqls, cnn, adOpenStatic, adLockReadOnly, adCmdText
If rst.RecordCount = 0 Then
Me.Hide
Form1.Show
MsgBox "No Matching RECORDS !", vbExclamation, " * Invalid Entry"
End If
because of this I am not able to finish my project. Kindly help me. My mail id is
itchocks@rediffmail.com
Thank you very much,
CHOCK.
Hai !!!
Question:Also send it to my mail ID. I did'nt get practice with forums, I don't know where to search this again.
<HTML>
<B><font color="#008000">HAVE A NICE DAY !</font></B>
<HTML>
Making A Retired Emplyee Records Inactive Instead Of Deleting His Records
I am developing a Payroll Software. Instead of deleting the records of a retired employee from the payroll, I want to make his records Inactive. This will allow the user of my program to be able to refer or recall the records of the retired employee if the need arises. I would want the retired employee's records to kept in an Arhive file if possible instead of deleting it completely.
I am totally ignorant of how to write the necessary codes.
I should be very grateful if you can help me out.
Thank you.
Akinyemi
SQL Statement - Listing The Records Where Those Records Are Not In The Bridging Table
Hi what would be the SQL command of when:
-You want to list all the records and columns of table A
- But, only if the employeeID is not in the table B
- If the matching employee ID is in the table B, that record or value corresponding to that ID won't be included in the result
table A
-------
field1 - employeeID
field 2 - firstname
field 3 - lastname
table B (bridging table or many-to-many)
------
field1 - employeeID (PK)(FK)
field x - xxx
field x - xxxx
and so on
Thank you
Increment Records And Loop Between Records Based On Condition
dear all,
I want to increment each record in my table 50 times.
for example if i have 3 records: 50,100,200.
I want to out put these record in a text file.
My first row in file will be 50(50+0), second will be 51(50+1), third wiil be 52 and so on till 99.
Now i want to do a check before incrementing the second record in my table.
only if next record, in my case = 100 minus first record 50 is 50 then go to next record and do the same incrementing.
if the minus operation is more than 50 than the file should be ended. and a new text file should be created.
i have done the incrementing part but i cant make the minus part work..
as i cannot get the second record in a variable
my code is below;
datum = Text1.Value
item_no = Combo1.Value
tmp_val = ""
serial = ""
If Not rs.EOF Then
rs.MoveLast
rcount = rs.RecordCount
rs.MoveFirst
Close
Open "c: est.txt" For Output As #1
While Not rs.EOF
For i = 0 To rs.Fields.Count - 1
serial = rs.Fields(rs.Fields(i).Name) + 0
tmp_val = serial & "|" & datum & "|" & item_no
Print #1, tmp_val
tmp_val = serial + 1
tmp_val = tmp_val & "|" & datum & "|" & item_no
Print #1, tmp_val
tmp_val = serial + 2
tmp_val = tmp_val & "|" & datum & "|" & item_no
Print #1, tmp_val
tmp_val = serial + 3
tmp_val = tmp_val & "|" & datum & "|" & item_no
Print #1, tmp_val
Next i
tmp_val = tmp_val & vbCrLf
tmp_val = ""
tmp_val = serial + 50
rs.MoveNext
If tmp_val = serial Then ......
DoEvents
Wend
Print #1, tmp_val
MsgBox "Process Completed"
Close #1
End If
End Sub
can some one help me please?
Textfile Records And Access Database Records Matching
how do i do matching whith using looping on textfile records and database records? if the records in textfile and access database are not match then it will have a output on a.txt and the output is retreive from textfile
the bugs is, there are no output (it suppose to have output)
please help ... thanx
VB Code:
Do While Not RS.EOF strFileNoDB = CatchNull(Trim(RS("FILE_NO").Value), "Null") strBenCdDB = CatchNull(Trim(RS("BEN_CD").Value), "Null") strBenNameDB = CatchNull(UCase(Trim(RS("BEN_NAME").Value)), "Null") strBenICPassDB = CatchNull(Trim(RS("IC_PASSP_B").Value), "Null") strGuardNameDB = CatchNull(UCase(Trim(RS("GUARD_NAME").Value)), "Null") strGuardICPassDB = CatchNull(Trim(RS("IC_PASSP_N").Value), "Null") strBenICPassDBHy = Replace(strBenICPassDB, "-", "") strGuardICPassDBHy = Replace(strGuardICPassDB, "-", "") strFileOutputDB = strFileNoDB & strBenCdDB & strBenNameDB & strBenICPassDBHy & strGuardNameDB & strGuardICPassDBHy If Left(ARBFile, 2) = "01" Then strTxnYear = Mid(ARBFile, 17, 4) strTxnMonth = Mid(ARBFile, 15, 2) strTxnYMJ = strTxnYear & strTxnMonth End If SeqNum = SeqNum + 1 strSeqNum = CStr(SeqNum) For x = 0 To aIndex If Left(ARBFiles(x), 2) = "02" Then If Len(strSeqNum) = 1 Then SeqNumJ = strSeqNum & " " ElseIf Len(strSeqNum) = 2 Then SeqNumJ = strSeqNum & " " ElseIf Len(strSeqNum) = 3 Then SeqNumJ = strSeqNum & " " ElseIf Len(strSeqNum) = 4 Then SeqNumJ = strSeqNum & " " ElseIf Len(strSeqNum) = 5 Then SeqNumJ = strSeqNum & " " ElseIf Len(strSeqNum) = 6 Then SeqNumJ = strSeqNum & " " ElseIf Len(strSeqNum) = 7 Then SeqNumJ = strSeqNum & " " ElseIf Len(strSeqNum) = 8 Then SeqNumJ = strSeqNum & " " ElseIf Len(strSeqNum) = 9 Then SeqNumJ = strSeqNum & " " ElseIf Len(strSeqNum) = 10 Then SeqNumJ = strSeqNum End If strFileNo = Mid(ARBFiles(x), 51, 8) strTxnStatus = "N" strBenCd = Mid(ARBFiles(x), 59, 2) If Len(strBenCd) = 1 Then strBenCdJ = strBenCd & " " ElseIf Len(strBenCd) = 2 Then strBenCdJ = strBenCd & " " End If strBenCdC = Trim(strBenCd) strBenName = UCase(Mid(ARBFiles(x), 61, 60)) strBenNameJ = Trim(strBenName) strBenICPass = Trim(Mid(ARBFiles(x), 15, 12)) strBenICPassJ = strBenICPass & " " strGuardName = UCase(Mid(ARBFiles(x), 165, 80)) strGuardNameJ = Trim(strGuardName) strGuardICPass = Trim(Mid(ARBFiles(x), 141, 12)) strGuardICPassJ = strGuardICPass & " " strAmount = Mid(ARBFiles(x), 271, 13) strAmountCent = Right(strAmount, 2) strAmountDecimal = "." & strAmountCent If Left(strAmount, 11) = "00000000000" Then strAmountRinggetFilterJ = "0" strAmountCombine = strAmountRinggetFilterJ & strAmountDecimal strAmountJ = strAmountCombine & " " ElseIf Left(strAmount, 10) = "0000000000" And Left(strAmount, 11) <> "00000000000" Then strAmountRinggetFilter = Right(strAmount, 3) strAmountRinggetFilter1 = Left(strAmountRinggetFilter, 1) strAmountRinggetFilterJ = strAmountRinggetFilter1 strAmountCombine = strAmountRinggetFilterJ & strAmountDecimal strAmountJ = strAmountCombine & " " ElseIf Left(strAmount, 9) = "000000000" And Left(strAmount, 10) <> "0000000000" And Left(strAmount, 11) <> "00000000000" Then strAmountRinggetFilter = Right(strAmount, 4) strAmountRinggetFilter1 = Left(strAmountRinggetFilter, 2) strAmountRinggetFilterJ = strAmountRinggetFilter1 strAmountCombine = strAmountRinggetFilterJ & strAmountDecimal strAmountJ = strAmountCombine & " " ElseIf Left(strAmount, 8) = "00000000" And Left(strAmount, 9) <> "000000000" And Left(strAmount, 10) <> "0000000000" And Left(strAmount, 11) <> "00000000000" Then strAmountRinggetFilter = Right(strAmount, 5) strAmountRinggetFilter1 = Left(strAmountRinggetFilter, 3) strAmountRinggetFilterJ = strAmountRinggetFilter1 strAmountCombine = strAmountRinggetFilterJ & strAmountDecimal strAmountJ = strAmountCombine & " " ElseIf Left(strAmount, 7) = "0000000" And Left(strAmount, 8) <> "00000000" And Left(strAmount, 9) <> "000000000" And Left(strAmount, 10) <> "0000000000" And Left(strAmount, 11) <> "00000000000" Then strAmountRinggetFilter = Right(strAmount, 6) strAmountRinggetFilter1 = Left(strAmountRinggetFilter, 4) strAmountRinggetFilterJ = strAmountRinggetFilter1 strAmountCombine = strAmountRinggetFilterJ & strAmountDecimal strAmountJ = strAmountCombine & " " ElseIf Left(strAmount, 6) = "000000" And Left(strAmount, 7) <> "0000000" And Left(strAmount, 8) <> "00000000" And Left(strAmount, 9) <> "000000000" And Left(strAmount, 10) <> "0000000000" And Left(strAmount, 11) <> "00000000000" Then strAmountRinggetFilter = Right(strAmount, 7) strAmountRinggetFilter1 = Left(strAmountRinggetFilter, 5) strAmountRinggetFilterJ = strAmountRinggetFilter1 strAmountCombine = strAmountRinggetFilterJ & strAmountDecimal strAmountJ = strAmountCombine & " " ElseIf Left(strAmount, 5) = "00000" And Left(strAmount, 6) <> "000000" And Left(strAmount, 7) <> "0000000" And Left(strAmount, 8) <> "00000000" And Left(strAmount, 9) <> "000000000" And Left(strAmount, 10) <> "0000000000" And Left(strAmount, 11) <> "00000000000" Then strAmountRinggetFilter = Right(strAmount, 8) strAmountRinggetFilter1 = Left(strAmountRinggetFilter, 6) strAmountRinggetFilterJ = strAmountRinggetFilter1 strAmountCombine = strAmountRinggetFilterJ & strAmountDecimal strAmountJ = strAmountCombine & " " ElseIf Left(strAmount, 4) = "0000" And Left(strAmount, 5) <> "00000" And Left(strAmount, 6) <> "000000" And Left(strAmount, 7) <> "0000000" And Left(strAmount, 8) <> "00000000" And Left(strAmount, 9) <> "000000000" And Left(strAmount, 10) <> "0000000000" And Left(strAmount, 11) <> "00000000000" Then strAmountRinggetFilter = Right(strAmount, 9) strAmountRinggetFilter1 = Left(strAmountRinggetFilter, 7) strAmountRinggetFilterJ = strAmountRinggetFilter1 strAmountCombine = strAmountRinggetFilterJ & strAmountDecimal strAmountJ = strAmountCombine & " " ElseIf Left(strAmount, 3) = "000" And Left(strAmount, 4) <> "0000" And Left(strAmount, 5) <> "00000" And Left(strAmount, 6) <> "000000" And Left(strAmount, 7) <> "0000000" And Left(strAmount, 8) <> "00000000" And Left(strAmount, 9) <> "000000000" And Left(strAmount, 10) <> "0000000000" And Left(strAmount, 11) <> "00000000000" Then strAmountRinggetFilter = Right(strAmount, 10) strAmountRinggetFilter1 = Left(strAmountRinggetFilter, 8) strAmountRinggetFilterJ = strAmountRinggetFilter1 strAmountCombine = strAmountRinggetFilterJ & strAmountDecimal strAmountJ = strAmountCombine & " " ElseIf Left(strAmount, 2) = "00" And Left(strAmount, 3) <> "000" And Left(strAmount, 4) <> "0000" And Left(strAmount, 5) <> "00000" And Left(strAmount, 6) <> "000000" And Left(strAmount, 7) <> "0000000" And Left(strAmount, 8) <> "00000000" And Left(strAmount, 9) <> "000000000" And Left(strAmount, 10) <> "0000000000" And Left(strAmount, 11) <> "00000000000" Then strAmountRinggetFilter = Right(strAmount, 11) strAmountRinggetFilter1 = Left(strAmountRinggetFilter, 9) strAmountRinggetFilterJ = strAmountRinggetFilter1 strAmountCombine = strAmountRinggetFilterJ & strAmountDecimal strAmountJ = strAmountCombine & " " ElseIf Left(strAmount, 1) = "0" And Left(strAmount, 2) <> "00" And Left(strAmount, 3) <> "000" And Left(strAmount, 4) <> "0000" And Left(strAmount, 5) <> "00000" And Left(strAmount, 6) <> "000000" And Left(strAmount, 7) <> "0000000" And Left(strAmount, 8) <> "00000000" And Left(strAmount, 9) <> "000000000" And Left(strAmount, 10) <> "0000000000" And Left(strAmount, 11) <> "00000000000" Then strAmountRinggetFilter = Right(strAmount, 12) strAmountRinggetFilter1 = Left(strAmountRinggetFilter, 10) strAmountRinggetFilterJ = strAmountRinggetFilter1 strAmountCombine = strAmountRinggetFilterJ & strAmountDecimal strAmountJ = strAmountCombine & " " Else strAmountRinggetFilter = Right(strAmount, 13) strAmountRinggetFilter1 = Left(strAmountRinggetFilter, 11) strAmountRinggetFilterJ = strAmountRinggetFilter1 strAmountCombine = strAmountRinggetFilterJ & strAmountDecimal strAmountJ = strAmountCombine & " " End If strFileOutputJ = strFileNo & strBenCdC & strBenNameJ & strBenICPass & strGuardNameJ & strGuardICPass If strFileOutputDB <> strFileOutputJ Then strARBFileContent = SeqNumJ & strFileNo & strTxnStatus & strBenCdJ & strBenName & strBenICPassJ & strAmountJ & strTxnYMJ Print #2, strARBFileContent ElseIf strFileOutputDB = strFileOutputJ Then Exit Do End If End If Next x RS.MoveNext Loop
How To Extract Records And Display Report Of Records That Are Blank
I am using the databound control in a new vb 6 program for a database of complaints. I have name , address, team, response number, open date, assigned date and completed date and some other fields that are all bound to a data2 control. I need a query that will return a report that lists all the records for a specified month (using a drop down box)with no Date_Complete (nothing entered into the field). So if the user selects March -- 2000 in two different drop down boxes. I need fields that have nothing in the Date_Completed field to print in a report. Only the records that have nothing in the Date_Complete fields should print or make the report. So the user can go back and make sure these complaints get completed. I would really appreciate the help; desperate to finish my program and it is overdue; Also, I have been using the data report feature but am open to suggestions. I don't know crystal reports at all so I need some exact and specific code here -- thanks!!!
even help w/ code using the drop down boxes to extract the data -- for example if the user select March in one drop down box and 2000 in another drop down box. I need the records that are not completed (Date_Completed) field to only show up in the report for March 2000.
How To Extract Records And Display Report Of Records That Are Blank
I am using the databound control in a new vb 6 program for a database of complaints. I have name , address, team, response number, open date, assigned date and completed date and some other fields that are all bound to a data2 control. I need a query that will return a report that lists all the records for a specified month (using a drop down box)with no Date_Complete (nothing entered into the field). So if the user selects March -- 2000 in two different drop down boxes. I need fields that have nothing in the Date_Completed field to print in a report. Only the records that have nothing in the Date_Complete fields should print or make the report. So the user can go back and make sure these complaints get completed. I would really appreciate the help; desperate to finish my program and it is overdue; Also, I have been using the data report feature but am open to suggestions. I don't know crystal reports at all so I need some exact and specific code here -- thanks!!!
even help w/ code using the drop down boxes to extract the data -- for example if the user select March in one drop down box and 2000 in another drop down box. I need the records that are not completed (Date_Completed) field to only show up in the report for March 2000.
How To Get Total Number Of Records Of Records Return By Recordset?
I wanna get the total number of records returned by the record set. I used RecordCount, but it always return -1.
some 1 plz help me out.
Dim cnn as ADODB.Connection
Dim ars as ADODB.Recordset
set cnn = new ADODB.Connection
With cnn
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:MapData.mdb;Persist Security Info=false"
.Open
End With
Dim SQL as string
SQL = " Select * from Education"
set ars = cnn.Execute(SQL)
MsgBox ars.RecordCount 'NOR WORKING???
...---.....
Hassan Zia
Hassan_Zia@mathtech-pk.com
Adding Records To A Table And Editing Records
What is the best way to bind text boxes to recordsets? Is it to put a recordsource (data1) on a form and then bind each text box to a column in data1 or is there another way. I know when using just Access alone I don't keep tables open I update records using append queries and update queries. Is this what I should be doing in VB as well? It seems hard to manipulate data on a form when there are 2 recordsources (data1 and data2) to get everything to the correct record I have to use data1.recordset.seek on an indexed column in the table.. is this a round about way to match records or is this the only way?
Adding Records So They Are Related To Records In Another Table.
I am trying to build a database with many one to many relationships. I got the view part down, and have a few records to in there to test, basically i choose a item from the first combo box, then the second combo box populates with items related to the first combo box and so on. When I add a new artist(first combo box) I want the second combo box to light up and allow me to add a new record related to the first. I'm not sure how I can pull this off, any help would be appreciated!
Saving Access Records, And New Blank Records
Hello and thank you for having a look at this post!
I have been meaning to ask this for awhile, and have yet to find an answer.
In VB when you are using an access database using ado is it possible to create a save function. The problem is that any changes made to the record are recorded right away. There is no need for save. ( i understand why this is, but would like to change it) Having the record save before the user hits saves seems to confuse them.
The other questions i have is how would i tell access or vb for that matter that a blank record is ok. I always recieve an error when trying to move from an empty record to another. Or when i create a new one, then try to browse to the next.
If more information is needed please let me know.
Thanks in advance for any replies given. It is always appreciated!
Best Way To Get The Number Of Records In A File With Millions Records
Hi all,
I have searched the threads looking for a way to get the total number of records in a file in one shot.
It looks like Split function into an array and using UBound is the answer.
However, I have a file that contains millons of records and that may be a problem.
Question: Is there another way of geting the total number of records in a file in one shot? Note that each line is delimited by vbLF.
Thanks in advance for any help.
Viewing All Records In An Array Of Records
Alright, problem description.
I have php code which looks like this:
PHP Code:
while($a_row = mysql_fetch_array($result)) {
foreach($a_row as $key => $value) {
All i really want to do is go though an array of records and see if EACH record in each row of the array is equal to 1.
so the vb goes somthing like this :
Code:
For i2 = Lbound(candidates) To Ubound(candidates)
thats fine to move down the rows of the array but how do you move along the records?
I supose that the 'for ... next' is the right structure to use again but my crappy vb book doesn't tell me everything.
I hope that makes sence!
Thanks again for your help
- Cyril
Inserting Records In Between Other Records In Excel
I dont know if this can be solved or not. I hope it can be. It's hard to word right, so bear with me. I have a recordset that I export to Excel. I have a column named date. The other columns are named according to the user's choice of test and contain values. If the user only chooses one check box everything is ok. When a user chooses more the columns continue to be named across the sheet and values inserted under them. But the corresponding dates overwrite all of the dates in the date column from the previous test. What I am really wondering is: can VB check the date column for the exact date and if the exact date is there insert the value in the same row in its correct column? But if the date isnt there, can it be inserted in chronological order where it is supposed to be and create a row with the value in the row and correct column? I dont know if this makes sense or not. I am new to working with VB. If anyone can offer help please do!
Thanks,
B
Remove Records And Restore Records
Sorry for this vaque title.
I'm creating a program to organize sports tournament. I'm using a MySql db in which I have all the matches of the tournament. During the tournament there are matches which still should be played and the matches which are played already .
I want to make a temperary back-up of the played matches. After doing so I want to remove all records of one poule. When I re-create the match records the backed up matches (at least certain fields) should be filled in the "new" records. I tried to make a clone of a recordset and then remove the records by using the orginal recordset. But doing so the cloned recordset will also be empty.
If somebody understands my problem please help me
Returning Value
I'm using the following command to make a sum from a range of cells.
Code:
Dim Pa As Integer
ActiveCell.Offset(1, 5) = WorksheetFunction.Sum(Sheets("BOMA").Range("F5", Sheets("BOMA").Cells(Range("F65536").End(xlUp).Row + 1, 6)))
Pa = ActiveCell.Offset(1, 5)
The program return an error and stops at Pa = ....
Debug shows that Pa = 0 even though the sum in this cell are something else.
Some ideas
Returning From A Sub
Can any one tell me is there a way to return from a sub function
such as:
sub Replace()
blablabla
end sub
is there a way to return to the place in another function where I called this sub from?
if not is there another way I can run the same procuder and come back to my starting point?
Returning A Value From A Sub?
well I have something along the lines of
VB Code:
public sub returnTest(theNum As integer)if theNum = 1 then'return something elseend ifexit sub
But, I don't know how to return something in vb.
I would like to use this sub like..
VB Code:
testVar = returnTest(1)
Returning A Value From An Exe
Hello,
I am trying to make an exe which returns a value to the command prompt when run through the command line. I am using cmd line parameters..
Thanks
Ajit
Mts, Vb6, W2k, Not Returning
It's only been a week and it's time for me to throw this out to bigger brains then mine.
I have a vb6 app that uses MTS objects to retrieve data and do other nifty db stuff. When it was on nt4 I wrote a report engine that used MTS and generated a html report for the user. Dam* users now want me to implement it on w2k.
I register the dll in component services, run the control on the client that calls it:
VB Code:
Set obj = CreateObject("RDS.DataSpace") Set report = obj.CreateObject("DCISReportEngine.Report", sServer) 'Set report = obj.CreateObject("DCISReportEngine.Report", "localhost") 'should return report url strURL = report.GenerateReport(Conn, sServer, sSQL, sRepDef, boolDup, boolGroup)
Now running locally it runs fine. But when the code above runs it creates the object (starts the package running on the server) but
returns a null string. It should return a string with a url in it.
So I ask what am I not getting? I added a log file to the MTS dll and it doesn't create the log so I'd guess it doesn't run.
But nothing tells me that it doesn't.
Suggestions? Mine regarding giving back my nt4 have gone unanswered.
Thanks for your time,
Dave
Returning Value From Exe
Hi,
Thanks for reading. I want a VB exe which should return a value say some success or failure regarding the operation happening inside it. Just like a C++ program returning a value to the console. And I want my java program to read this. How can I return the value from my VB program?
Thnx,
Pres.
I Really Don't Know (returning A Value)
My problem is kinda complicated. I have made my own msgbox because the normal msgbox freezes my program and that's not good. But now I can call the function. This opens a form and if it's already openend it put's the info into a type MSGINFO. So far so good. That form raises an event to tell if a button got clicked. Now when that happends I want to return the value to where the sub got called. And that's not possible (I think). But I don't want the sub wich calls the msgbox form to use something like:
DO
DOEVENTS
LOOP until Clicked
and then save in the boolean clicked if it got clicked cause that uses to much resources and gives up to much time. It's kinda complicated but I hope someone has got an answer.
Why Is It Returning Nothing?!?!?
I have this code piece to try and convert a month in numbers to the actual month like 11/ would be november. But I get a blank msgbox when I try this code and I can not figure out why! thanks for any help!
Dim strdate As String
Dim strmonth As String
Dim theday As String
Dim str2 As String
Dim strday As String
Dim chkmonth As String
strdate = Text1.Text
If Left$(strdate, 3) = "/" Then
Select Case Mid(Text1.Text, 1, 2)
Case "10"
str2 = "October"
Case "11"
str2 = "November"
Case "12"
str2 = "December"
End Select
strmonth = str2
End If
MsgBox strmonth
API Returning Nothing
I got a few problems...
What do you do when you use a GetText Function to get the text on a window and nothing comes back? Like you know for a fact your code is right and bug free. I thinking the window has something blocking API or something. Some windows and objects dont let you use API on them is that possible? Some windows/objects you can't hide. Like Ad bars that dock on ur computer and stuff. How can you hide em? Also I know of one window i have you can SEE it has a title bar and a caption in it, but an API spy can get it's caption.
- How do you get around all of this? -
- How can I hide the windows i want to hide, and get text from objects that have text in em like a text box or maybe password box, or even a label, and captions? -
Maybe theres something I would use instad of API??
Please help...
My GetText Function:
Code:
Public Function GetText(WindowHandle As Long) As String
Dim TheText As String, TL As Long
TL = SendMessageLong(WindowHandle, WM_GETTEXTLENGTH, 0&, 0&)
TheText = String(TL + 1, " ")
Call SendMessageByString(WindowHandle, WM_GETTEXT, TL + 1, TheText)
TheText = Left(TheText, TL)
GetText$ = TheText
End Function
Returning A Value
So I'm working on my gradebook programme. As mentioned in other posts I'm a teacher though not of computers - that's just a hobby.
I have a form with 5 textboxes in an array txtMark(0), txtMark(1) etc.
Each one contains a mark for a quiz. Now, if a student is missing a mark due to absence or something I want to recalculate the average based on the number of marks available. If there are only 4 marks then the divisor for that average should be 4.
Here is my code for the command button to calculate the average
Private Sub cmdAverage_Click()
intDivisor = txtMark().Count 'sets the divisor to the same number as there are textboxes
ReCalc (intDivisor)
Dim i As Integer
intTotal = Val(txtMark(0).Text) + Val(txtMark(1).Text) + Val(txtMark(2)) + Val(txtMark(3)) + Val(txtMark(4))
'I know that line is clumsy - I'll tidy it up later
txtAverage = CInt(intTotal / intDivisor)
End Sub
I also have a function ReCalc which is supposed to iterate through the text boxes and if any of them are empty, the divisor should be reduced accordingly:
Public Function ReCalc(intDivisor) As Integer
Dim i As Integer
Dim ctr As Integer
ctr = 0
Dim ctl As Control
For Each ctl In Controls
If TypeOf ctl Is TextBox Then
If ctl.Text = "" Then
ctr = ctr + 1 ' supposed to count how many text boxes are empty
intDivisor = intDivisor - ctr 'supposed to reduce the divisor by the number of textboxes that are empty
End If
End If
Next ctl
End Function
Unfortunately it just doesn't work. intTotal is always divided by 5 regardless of how many textboxes contain text. I'm not getting any errors so it must be a logic error but I can't see it. Any help?
Thanks For Returning...
Hi,
I juz like to thank the adminstrators of this discussion board...I had so many questions regarding vb programming during the time the board was not functioning and felt so helpless... I took a long time to figure out how to solve problems compared to when I can juz pose the questions to ppl who help out with answering of questions on this board.
Juz to show my gratitude
Adrel
Returning Mouse Down
Hey, I'm making a game and I have a bunch of Shapes on my form. When a user clicks on one of the shapes I would like it to return which shape it is so I can add a color to the shape that is clicked.
Example:
o o o o o <----Shapes (In an array 0-4) called shapePeg
^ ^ ^ ^ ^ <----Colored Shapes named shpRed, shpYellow, shpBlue, shp Green shpOrange
now say the user clicks on the shapePeg(2) shape, I want it to return that shape so that when the user clicks on one of the color shapes, the color will then go into the shapePeg(2)
I hope it isn't to confusing.
Help Returning Line Set?
Hi, i have the following problem.
I have a 6 multine textboxes not linked to eachother in any way, EXCEPT.. that they contain information wich is related to eachother..
like this :
Code:
text1: text2: text3: etc
info1 info2 info3
info1 info2 info3
info1 info2 info3
info1 info2 info3
as you can see, the first line of text1 .. contains information relevant to the same line in text2/text3/text4/text5/text6.
if you still dont understand 1 more example :
say we have a chair.. and we put it in a table.
Code:
colour type serial
blue antique 123-3472
red old-style 234-4567
now i want those information bits to be linked to eachother by counting the lines on wich they exist.
say i would want to see what would exist on lines 100~200
so therefor i would need it to do this :
1. Count the lines in text1 , start reading from line 100 .. and stop at line 200
2. print those in any way ( im going to write them to a textfile ).
3. then do point 1 for text2 till text6. and print those also.
how would i go by this?
i know how to count the lines and all that
Code:
Private Sub Count_Click()
Dim Pieces1() As String
Dim string1 As String
Dim lines As Integer
Dim i As Integer
string1 = Text1.Text
Pieces1 = Split(string1, vbNewLine)
For i = LBound(Pieces1) To UBound(Pieces1)
lines = lines + 1
Count.Text = lines
Next i
End Sub
but then i wouldnt know how to read the content of that single line, and even how to read multiple lines.
Please help me with this!
thank you
Jeroen van Vierzen
Old Toolbar Keeps Returning
Hi all,
Has anybody had problems changing to a later version of a custom toolbar.
I have a toolbar that has a menu on it, once an option is clicked it runs a small VBA program. This toolbar was attached the workbook and when opened appeared on the receiving PC.
I added some more options a while ago and I had a lot of problems getting the new toolbar to appear. Again I've added more options and now I'm pulling my hair out because the toolbar is reverting back the original one, version 1.....
I've asked the user to delete the original file and toolbar. There is now nothing on the machine relating to my custom toolbar. I have then deleted the attached toobars from my workbook and saved. Next step is to reattach the latest toolbar to my workbook.
Again the user still gets the old toolbar from 2 versions ago.
Help!!!!!!
Cheers
Tom
VBA: Returning The Top 'x' Results.
I need to display 'x' number of results.
The 'x' is user defined.
The results are generated by a Query then displayed by a report.
I have tried the SQL TOP command, but it appears you cannot link that to an input box located on a Form direct to the Query.
I have tried to generate an incrementing number field in the query, but this was also to no avail. If this would have worked then I could simply limit the amount to display.
Any ideas on this are greatly appreciated.
Cheers,
Si.
Returning A Value, Not A Formula
Hey all, I need a little help with something pretty basic. I have a macro that performs a simple calculation. How do I return only the result, the integer information, to the cell without the formula tracking along with it?
ActiveCell.FormulaR1C1 = "=R[-1]C+1"
Thanks for any help on this!
XLS MsgBox Returning A Value
I'm an idiot. I'm sure this is a super easy fix and I'm just overlooking something.
Heres what I have
Code:
Private Sub Validate()
Dim EmpName As String
EmpName = Range("B2").Value
Ans = MsgBox("Are you" & " EmpName " & "?", vbYesNo, "Validating")
Select Case Ans
Case vbYes
' Code for yes
Case vbNo
Range("B3").ClearContents
Call GetName
End Select
End Sub
The Message box shows "Are you EmpName?" It doesn't show like, "Are you DrSwaity?" if thats what was in B2. I think it looks good, but obviously not.
One consideration is B2 contains a "=vlookup" formula. There is a value in the cell...
Anyways, thanks in advance!
Returning A String From A VB6 Std DLL
I have created a standard (not ActiveX) DLL from VB6 and am trying to return a string to the calling application from the DLL function. The problem is that the string returned is in wide character format (nulls in between characters)...is it possible to return it in narrow character format (no inter-character nulls)?
Returning The Address
i whouldnt know what to google to find the answer to this so ill ask on a fourm. i whould like to make a program that can copy itself to another directory. i know how to copy just fine, my problem is that, i dont know how to return the current address of the program. say someone downloads my progam and saves it were ever(c:/downloads/stuff/) for example. how do i make my program return (c:/downloads/stuff/myprogram.exe) as a string, so i can make it copy it and save it to another directory?
Returning Focus To VB
I have a VB program which instructs an Application (AutoCAD), to do a number of things, including "zoomAll". THis sets the focus on the AutoCAD application. Then to proceed with the VB program's Code, I always have to manually click on the VB interface. This returns the focus to the VB program and so teh VB code is resumed.
The problem this is to be a server program so I need ensure that the focus is returned to the VB program automatically.....Any suggestions would really be appreciated.
Thanks
Gwyn
|