How To Proof If A Field Is Empty ??
Hellllooo,
i want to proof if a table field is empty. I tried this :
If !State = "" Then Text3(2).Text = "No Content !" Else Text3(2).Text = !State End If
Does anybody know a working solution ?? Mine causes error: illegal use of null. Means that !State is empty and Text3(2).Text doesnīt like empty fields or content.
Please help. Thanks
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
SQL - Select All Records From Table Where Field Is Empty / Not Empty ?
I have a problem here in that I dont know how to execute this SQL query as I am not sure of the correct syntax...
I am trying to select all records from a recordset (populated by a table), where a particular field is empty...
So I guessed...
db.Execute("SELECT * FROM CUSTOMER ORDERBY CustomerID WHERE CustTelephone = "" ")
but its not working...
Similiarly, I need a query that returns all records where a certain field is filled, I have no idea how to do this one...
Guessed at...
db.Execute("SELECT * FROM CUSTOMER ORDERBY CustomerID WHERE CustOrder = "'(value)'" ")
(where '(value)' would mean any value at all)
funny enough its not working either
Can anyone please help ?
Thanks
SQL - Select All Records From Table Where Field Is Empty / Not Empty ?
I have a problem here in that I dont know how to execute this SQL query as I am not sure of the correct syntax...
I am trying to select all records from a recordset (populated by a table), where a particular field is empty...
So I guessed...
db.Execute("SELECT * FROM CUSTOMER ORDERBY CustomerID WHERE CustTelephone = "" ")
but its not working...
Similiarly, I need a query that returns all records where a certain field is filled, I have no idea how to do this one...
Guessed at...
db.Execute("SELECT * FROM CUSTOMER ORDERBY CustomerID WHERE CustOrder = "'(value)'" ")
(where '(value)' would mean any value at all)
funny enough its not working either
Can anyone please help ?
Thanks
Proof VB Is Buggy (my 'proof' Has Been Overturned)
OK heres the code i use.
VB Code:
Private Sub Form_Load() Dim i As Byte, x For i = 1 To 255 Step 1 'MsgBox i DoEvents x = i - 63 If x < 1 Then 'x = 255 + (i - 63) 'x = x + 63 'x = 255 - 255 End If Debug.Print "x = " & x Debug.Print "i = " & i NextEnd Sub
Heres what the immediate window gives me:
Code:
i = 156
x = 94
i = 157
x = 95
i = 158
x = 96
i = 159
x = 97
i = 160
x = 98
i = 161
x = 99
i = 162
x = 100
i = 163
x = 101
i = 164
x = 102
i = 165
x = 103
i = 166
x = 104
i = 167
x = 105
i = 168
x = 106
i = 169
x = 107
i = 170
x = 108
i = 171
x = 109
i = 172
x = 110
i = 173
x = 111
i = 174
x = 112
i = 175
x = 113
i = 176
x = 114
i = 177
x = 115
i = 178
x = 116
i = 179
x = 117
i = 180
x = 118
i = 181
x = 119
i = 182
x = 120
i = 183
x = 121
i = 184
x = 122
i = 185
x = 123
i = 186
x = 124
i = 187
x = 125
i = 188
x = 126
i = 189
x = 127
i = 190
x = 128
i = 191
x = 129
i = 192
x = 130
i = 193
x = 131
i = 194
x = 132
i = 195
x = 133
i = 196
x = 134
i = 197
x = 135
i = 198
x = 136
i = 199
x = 137
i = 200
x = 138
i = 201
x = 139
i = 202
x = 140
i = 203
x = 141
i = 204
x = 142
i = 205
x = 143
i = 206
x = 144
i = 207
x = 145
i = 208
x = 146
i = 209
x = 147
i = 210
x = 148
i = 211
x = 149
i = 212
x = 150
i = 213
x = 151
i = 214
x = 152
i = 215
x = 153
i = 216
x = 154
i = 217
x = 155
i = 218
x = 156
i = 219
x = 157
i = 220
x = 158
i = 221
x = 159
i = 222
x = 160
i = 223
x = 161
i = 224
x = 162
i = 225
x = 163
i = 226
x = 164
i = 227
x = 165
i = 228
x = 166
i = 229
x = 167
i = 230
x = 168
i = 231
x = 169
i = 232
x = 170
i = 233
x = 171
i = 234
x = 172
i = 235
x = 173
i = 236
x = 174
i = 237
x = 175
i = 238
x = 176
i = 239
x = 177
i = 240
x = 178
i = 241
x = 179
i = 242
x = 180
i = 243
x = 181
i = 244
x = 182
i = 245
x = 183
i = 246
x = 184
i = 247
x = 185
i = 248
x = 186
i = 249
x = 187
i = 250
x = 188
i = 251
x = 189
i = 252
x = 190
i = 253
x = 191
i = 254
x = 192
i = 255
OK, first of all, it prints "i" before anything else, when "x" was the
line of code before that. Second of all, "i" started at 156, i asked
it to start at 1...
Empty Field?
Hi
I have a Data Grid Control that is connected via ADODC to a Microsoft Access DB. I want the user to be able to add, modify, or delete records on the grid. This all works fine, except when the form opens up, the first field of the first record is blank with the cursor blinking there. For some reason it sticks the cursor there and erases what was previously in that field.
Does anyone know how to remedy this?
Thanks!
Empty Field
What is the value of an empty field? I tried testing a recordset for empty fields like this...
Code:
if rsTabSearch.Fields("FileProperties") = "" then
'code here
end if
if rsTabSearch.Fields("FileProperties") = Null then
'code here
end if
but none are working... Any thoughts on this?
How To Tell A Field In A Recordset Is Empty
Ok I am implementing a database application. I am working with MaskEdBox this is how i have it working, one form comes up and the user types in the name they want to search for, then another form pops up with the matches in a listbox, then u click on the name u want and it jumps back to the orignal form, but the problem is i need to know how to tell in code if a particular field in recordset is empty. Like for instance
I am searching for Jimmy I find his name on the list and i click on his name, how can i tell before populating the form with his info if the recordset has nothing for his address or so on. Any help would be greatly appreciated
here is what i have
If rs!Workphone = "" Then
mskphone.Mask = mskphone.Format
Else
mskphone.Text = rs!Workphone
End If
How To Figure Out The Empty Field?
I have following code to read one text filed(atafromemail.txt), and change the pattern to another text file(SwitchPattern.tex). finally, convert to excel
datafroEmail.txt:
Total Amount: $8.95 USD
Currency: U.S. Dollars
Transaction ID: 32238683KU050193G
Item Number: 30524117856
Buyer: Betsi Coleman
Buyer's User ID: betsitwo
Message: bla ...
betsitwo's CONFIRMED Address: 1234 St.
.
.
SwitchPattern.txt:
"$8.95 USD","U.S. Dollars","32238683KU050193G","30524117856","Betsi Coleman","betsitwo", "bla ...", "1234 St."
My problem is sometimes data from email no the Message line at all.
This will cost problem in switchPattern file like the address line will move foward to Message field and so on. If there were more than one record, the whole thing will mess up. Anybody help?
<vbt>
Private Sub TextSwitch()
Dim txtAmount, txtCurr, txtTranID, _
txtNum, txtBuyer, txtUserID, txtmessage, txtAddress, xR As String
Dim i, j
Open App.Path & "SwitchPattern.txt" For Output As #1
Open App.Path & "DataFromEmail.txt" For Input Access Read As #6
Do While Not EOF(6)
Line Input #6, xR 'Read a line
If Left(LTrim(xR), 14) = "Total Amount: " Then
txtAmount = Right(xR, Len(xR) - 14)
Write #1, txtAmount,
End If
If Left(LTrim(xR), 10) = "Currency: " Then
txtCurr = Right(xR, Len(xR) - 10)
Write #1, txtCurr,
End If
If Left(LTrim(xR), 16) = "Transaction ID: " Then
txtTranID = Right(xR, Len(xR) - 16)
Write #1, txtTranID,
End If
If Left(LTrim(xR), 13) = "Item Number: " Then
txtNum = Right(xR, Len(xR) - 13)
Write #1, txtNum,
End If
If Left(LTrim(xR), 7) = "Buyer: " Then
txtBuyer = Right(xR, Len(xR) - 7)
Write #1, txtBuyer,
End If
If Left(LTrim(xR), 17) = "Buyer's User ID: " Then
txtUserID = Right(xR, Len(xR) - 17)
Write #1, txtUserID,
End If
If Left(LTrim(xR), 9) = "Message: " Then
txtmessage = Right(xR, Len(xR) - 9)
Write #1, txtmessage,
End If
j = InStr(1, xR, ":", 1)
i = InStr(1, xR, "CONFIRMED Address:", 1)
If i <> 0 Then
If Mid(LTrim(xR), i, 18) = "CONFIRMED Address:" Then
txtAddress = Right(xR, Len(xR) - j)
Write #1, txtAddress
End If
End If
Loop
Close #6 'Close
Close #1
End Sub</vbt>
Thank you!
Fang
Filter For Empty Field In ADO
I want to filter a Recordset for two cases of a date field: either empty or not.
On other fields, I am using:
rs.Filter = "FieldName = Whatever" which works fine.
How do I specify FieldName = "" or Fieldname <> ""?
As you can probably tell, I am new at this :-)
Thanks!
Problem With Empty Field ..
Im trying to update a table in my database.. and im using ".Find" to locate the column to be updated..
but it must only update if txt_name = fld_name and lbl_date = fld_date and fld_time_out is empty ..
my problem is , the fld_time_out = ' " + empty + "'" doesnt work..
any ideas or alternative i can use ? .. thanks..
please check my code:
Adodc1.Recordset.Find "fld_name = '" + txt_name.Text + "'"
Adodc1.Recordset.Find " fld_date = '" + lbl_date.Caption + "'"
Adodc1.Recordset.Find " fld_time_out = '" + empty + "' "
If Adodc1.Recordset.EOF Then
MsgBox ("..")
Else
With Adodc1.Recordset
.Fields!Fld_time_out = lbl_time
.Update
End With
MsgBox ("record saved")
Adodc1.Refresh
End If
Updating An Empty Field
Im trying to update all my fields in Access where the fld claimnumber is blank
Set mrstDWCActivityLog = GdbDWC.OpenRecordset("tblactivitylog")
GdbDWC.Execute "UPDATE tblactivitylog " & _
"SET fldClaimNumber='" & dbcClaimNumber.BoundText & "' " & _
"WHERE fldClaimNumber='" & "" & "'"
Im Just not sure how to find an empty field.
can anyone help
Refering To An Empty Field?
I can't figure this one out, how would you refer to an empty field in the database? Closest I can come with is something like:
Code:
If datLeague.Recordset!Name="" then
Something along those lines... except databases obviously can't be refered to as "".
What's the code you need to make this reference?
Select Where Field Is Empty ?
Hi everyone ...
Using VB6, Access2000 and ADO, I need to do what should be a simple select statement.
In plain english I need to Select everyting from table1 where field3 is NOT empty.
The field data type is Text.
When I use the SQL below, I get a syntax error.
Here is the SQL ... any help?
Code:
strSQL = "Select * From Table1 Where Field3 <> """
SQL For Access - Where Field Is/is Not EMPTY
How can I query where a field is either empty or not empty?
I would normally do...
VB Code:
recordset.Source = "SELECT * FROM table WHERE [FIELD] = 'xyz';"
but obviously in this case i want to do it so it'll bring back the records if the field is zero length and another for if it is not zero length. Anyone know how to do this?
thanks.
How Do I Evaluate An EMPTY RS Field?
I have a SELECT that brings back records but sometimes one of the Fields in the RS will be empty. So, whenever I use the code below on an empty RS field value I get the error, "can not be found in the ordinal", message. How can I just check if the RS field value has something in it?
Code:
if len(rs("ResponseTest")) = 0 then
thanks
Populate Empty Field
Using code- Is there anyway to enter a value into an empty field in a recordset? Maybe by using an If...Then statement???
Thanks for help
paul
Characterization Field Empty
This probably isn't the correct forum, but I'm a VB guy so....
I'm using the Indexing Service for searching through the contents of PDF documents. A couple of the fields I want to get data from, Characterization and DocSubject, are returned as Null. I set the cached = true for these properties, made sure the Generate Abstracts was set to True for the Indexing Service (catalog inherits this value), restarted the service, and initiated a full rescan of all directories of the catalog.
According to articles I've read I understand it may take some time before the word lists are updated, but it's been several hours and I only have a small amount of test documents in the directories (about 30 files, most are about 50KB, the biggest is about 500KB).
I did find one web article that mentioned a GenerateCharacterization attribute in the Registry that should be set to 1. Of the three attributes I found in the Registry with that name, one was set to zero. So I set that to 1, but it didn't make a differnce.
Here's a sample of my code:
CODE Dim rs As ADODB.Recordset
Dim strConn As String
Dim strSearch As String
On Error GoTo ErrHandler
Set rs = New ADODB.Recordset
strConn = "Provider=MSIDXS;Data Source=MyCatalogName"
strSearch = "SELECT Size, DocTitle, DocSubject, FileName, Characterization from SCOPE()"
rs.Open strSearch, strConn
'rs("Characterization") and rs("DocSubject")
'are both Null!
Data Field (Empty) Not Found
I am trying to create a limited dynamic data report - I scan the field names in from the recordset and then fill the text controls - data field properties with the names scanned in etc.
Unfortunatelly some times there are not enough field names to fill all the text controls and so I get the data field (empty) not found message.
Does anyone know how to assign a null value to a data field, or some way round it ??
On error resume next does not work
Cheers
Paul
Saving A Empty Textbox To A Db Field
im getting the zero-length string error, this isn't a problem when im saving a new record, i just dont update those fields that are blank,, but when im trying to edit a field i need to remove the old data and replace it with the new data... even if the new data is "".... how can i take an empty string and save it to a field?
Data Field (Empty) Not Found
I am trying to create a limited dynamic data report - I scan the field names in from the recordset and then fill the text controls - data field properties with the names scanned in etc.
Unfortunatelly some times there are not enough field names to fill all the text controls and so I get the data field (empty) not found message.
Does anyone know how to assign a null value to a data field, or some way round it ??
On error resume next does not work
Cheers
Paul
Empty Field Causing A Problem
Just as one problem gets sorted up crops another
I've got a small database with 4 records in it (see attachment) but on the fourth record the person didn't have a company name so I left the field blank
I expect to have many records with blank fields in them but my program doesn't like them being blank and comes up with some 'invalid use of null' error
Instead of running through and putting the data into the textboxes for each record and just that record I think its trying to put into each textbox the data that comes next in the database - if that makes sense
Any Advise?
How To Check An Empty Field On A Form?
Here's the code I have for a text field on my form.
If Len(.Text1(5).Text) > 0 Then
If Not IsDate(.Text1(5).Text) Then
MsgBox "The received date must be a valid date."
Exit Sub
End If
End If
I always gives me the msgbox error even when I don't put anything in that field. I can't figure out why. The field's default text is empty, so I don't understand how it's getting inside that first if statement. Anyone have an idea or a better way to do this? thanks.
Data Report - Empty Field
I created a data report with ADO and the record set is prepared on the fly. Some of the columns in the record set will be empty. But the data report does not allow me to have empty fields. How do I have it ?
Thanks in advance
James
Recordset Field Value Empty When Using CursorLocation = AdUseServer
Greetings!
Here's my problem:
I have a recordset that ABSOLUTELY needs to have server side cursor.
If I do something like:
Code:
Dim oConn as ADODB.Connection
Dim oRs as ADODB.Recordset
Dim sSql as String
Dim sValue as String
sSql = "SELECT * FROM Item WHERE pkIdItem = 1"
Set oConn = New ADODB.Connection
oConn.CursorLocation = adUseServer
Set oRs = oConn.Execute(SQL)
While Not oRs.EOF
sValue = oRs("The75thField")
'// Here, I grab all the 75 fields from the recordset, or do whatever I need
'// to do with the values.
Wend
Set oRs = Nothing
Set oConn = Nothing
I have lots of fields that are "Empty" (not null or "").
Does anybody have any idea how to fix this problem? This particular behavior always happens when I am using tables that have lots of fields inside. Usually, I just fix it by setting the Cursor Location to "adUseClient", but for a reason of "memory managing" and speed of my application (kind of...), I absolutely need to use a server side cursor.
Thanks in advance!
Validate The Empty Field Based On Tab Index
Code:
How can i validate the empty field based on tab index ?? The following code only can found out the empty field randomly.
Public Function ValidateEmptyField(formName As Form) As Boolean
ValidateEmptyField = False
Dim ctrl As Control
For Each ctrl In formName.Controls
If TypeOf ctrl Is TextBox Or TypeOf ctrl Is ComboBox Or TypeOf ctrl Is RichTextBox Or TypeOf ctrl Is ImageCombo Then
If Not ctrl.Visible = False Then
If ctrl.Text = vbNullString Then
MsgBox "Please Fill up the " & ctrl.Tag, vbCritical, "Save Failed"
If ctrl.Enabled = True Then
ctrl.SetFocus
End If
ValidateEmptyField = True
Exit Function
End If
End If
End If
Next
End Function
Thanks for any reply !!!
Empty Date Field Entry Problem
I have several text boxes in a VB6 entry form that take short dates and saves them to an Access 2002 db. If they all get filled the save works fine. If any one is left empty I get the following error message: Syntax error in date in query expression '##'.
The code used to Enter and Save them is:
VB Code:
Con.Execute "INSERT INTO Contract (Date_Filed [and 17 other fields]) VALUES (#" & TxtDate_Filed.Text & "#, [and 17 other field values])"
I have read about a "Null" problem but don't know if this is an instance of that since I don't get the "Invalid Use of NULL (94)" error message. Any help appreciated. --Ed
How To Insert Empty String In Numeric Field?
Hi,
I'm connecting to a database via ADO. The table contains several fields that are of the Number data type.
If I go in the table itself, I can clear out the values in these fields but how can this be done in VB?
I try and use the following peices of code witout any luck:
oRs!Field1 = ""
oRs!Field1 = vbNull
oRs!Field1 = vbNullString
It keeps returning the type mismatch error. Please keep in mind that I do not want to put 0 into the field, I want to make them blank, or null. This works if the field is a Text type, but not with Numeric type.
Any help or examples would be greatly appreciated..
Dan
Showing Datareport Empty Field Borders
I have a datareport that works perfectly in every way, except that my empty fields do not show borders. I have some fields that get their data from a database, which work fine. The problem is the empty fields, which need to show just empty cells, but instead have no border and are just empty space. (The user will print out the form and fill in these last parts by hand, so I need to make the form idiot resistant and clearly show the spaces to write in. The borders for all the fields are set as "1-rtBSSolid". The empty fields are labels. Any help is appreciated
(btw, I posted this to another forum and have gotten no help, so I'm hoping DevShed will come through for me )
How To Display Filled And Empty Field At A Time
hi all,
a) I want to display the value of fields in which some of have data and some are empty from an access file.
b) I am using login ID and Password for the user in my project but I want to know being an administrator who and when is logging in.
pl. help me
surnasiv
How To Still Show Query Results When 1 Field Is Empty?
I've installed MSDE SQL Database and put a database in it by importing an access database into it.
It is a relational database. I've written a sql statement that uses INNER JOIN to get data from a table and display it.
The problem is that every record that has even one empty field does not show up in the results.
Example... in the example below all records have a Stocknumber yet if a record doesnt have anything in the "model" field it wont display the record at all. It Will display all records that have All fields filled.
How can I make the records still show even if one field is empty?
Thanks for any info.
Code:
'my SQL statement
SELECT dbo.VehicleMaster.StockNumber
FROM dbo.VehicleMake
INNER JOIN dbo.VehicleMaster ON dbo.VehicleMake.VehicleMakeID = dbo.VehicleMaster.Make
INNER JOIN dbo.VehicleModel ON dbo.VehicleMaster.Model = dbo.VehicleModel.VehicleModelID
Edited by - Matrix1000 on 2/29/2004 9:29:46 PM
How To Show Fields By Relation When The Field Can Be Empty
Hi all,
in my uploaded file you can see a part of my ERD. I also uploaded the TSQL for easily recreating the tables.
I want to have a dataset containing:
Role,Page, View(y/n), Insert(y/n),Update(y/n),Delete(y/n)
I found a close solution with following query:
SELECT dbo.PagePermission.IntranetRoleId, dbo.PagePermission.PageId, dbo.PagePermission.PermissionId AS V, PagePermission_1.PermissionId AS I, PagePermission_2.PermissionId AS U,
PagePermission_3.PermissionId AS D
FROM dbo.PagePermission FULL OUTER JOIN
dbo.PagePermission PagePermission_3 ON dbo.PagePermission.IntranetRoleId = PagePermission_3.IntranetRoleId FULL OUTER JOIN
dbo.PagePermission PagePermission_1 ON dbo.PagePermission.IntranetRoleId = PagePermission_1.IntranetRoleId FULL OUTER JOIN
dbo.Page ON dbo.PagePermission.PageId = dbo.Page.Id FULL OUTER JOIN
dbo.PagePermission PagePermission_2 ON dbo.PagePermission.IntranetRoleId = PagePermission_2.IntranetRoleId
WHERE (dbo.PagePermission.PermissionId = 1) AND (PagePermission_1.PermissionId = 2) AND (PagePermission_2.PermissionId = 3) AND (PagePermission_3.PermissionId = 4)
GROUP BY dbo.PagePermission.PageId, dbo.PagePermission.PermissionId, PagePermission_1.PermissionId, PagePermission_2.PermissionId,
PagePermission_3.PermissionId, dbo.Page.PageName, dbo.PagePermission.IntranetRoleId
yet when one of the permissions doesn't exist for a certain role in a certain page; the record is not shown at all. I'd like to see the Null's as well. What am I doing wrong?
Edited by - Sensytje on 1/26/2006 4:35:55 AM
Returning A Date/Time Field To Empty
I am accessing a database in the following manner:
set db = OpenDatabase("c:Databasename.mbd", false)
set rec = db.openrecordset("tblName",dbOpenDynaset)
rec.MoveFirst
Do Until rec.eof
With rec
.Field("date")=vbNull
.MoveNext
End With
Loop
It continues to fill the date with "12/31/1899"
I can't figure out how to just delete the information in the field so that it is empty.
Jason Hatt
Write To File Produces #NULL# From Empty Field
I am trying to write the contents of some of the fields of my form to a text file. For use with an other application.
I would like the results of empty fields to be written to the text file with just another comma. However the empty fields always get written to the text file as #NULL#
How can I get arounds this?
BTW I'm new to VB6
Much thanks in advance
Multiple-Step Operation Generated Errors When Setting Date Field To Empty Or Null
I have a form with a bunch of bound controls and a few are date fields. When I try to clear out a date that has been previously set in the record I get the Multiple-Step Operation Error -2147217887(8004e21) The database allows nulls for these date values, so it is OK at the DB level - looks like the ado is causing the problem.
DB is SQL Server 2000
I found the following on Microsoft's site that is directly related to my problem - looks like there is no workaround according to them.
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q247/2/02.asp&NoWebContent=1
Anyone else have any ideas? There is to much invested in using the bound controls at this point - I cannot abandon this method.
Dangit---I Want Proof---
I read in a book a long time ago post vb5 don't remember if it was pre or post vb6 though---
In vb not to use
Dim x As Integer, y As Integer
because the 2nd variable---y is actually a variant, and then made into a late-bound integer (ie---that's why you can't set y to a string)
I also read in the same book not to use shorthand anymore either b/c it wasn't reliable.
Dim i% (int)
dim j& (long)
dim strM$ (string)
Someone give me the scoop. Is this vb5 only?
How Can I Proof If There Are 2 Or More Identic ...
... column values in my table. f.ex. i got columns named ID an 2ID. Itīs possible that there are 2 identic IDs but with different 2IDs.
How can i proof if there are 2 or more identic IDs and get them values ??
I try this under VB6 and work with ADO. I try not to use SQL Statements.
Iīd like to put the mutliple present IDs into another table.
Thank you guys..
A 3 Y/o Kid Proof Interface
I've offered a friend to create a simple interface for her 3 year old grandson to use on the computer so he can just run Paint and two 3rd party games. There's also a text box for him to type in.
I'm not sure what all I'll need to do to keep him from getting at anything but the 3 different programs. I want to for sure disable the alt-crtl-del combo and the start menu. How can it be set up to only let the program and the 3 others? I've uploaded the form. I don't have anything else yet.
I should be able to find the api for the alt-crtl-del combo on the board, but any other thoughts would be greatly appreciated.
Thanks for the help
Proof My Computer Hates Me... Please Help
PHP Code:
For i = 0 To 20000
hFont = CreateFont(18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Book Antiqua")
Call SendMessage(frmMain.hWnd, WM_SETFONT, hFont, 0)
Call DrawText(frmMain.hdc, "Page " & Page & " of " & Total, Len("Page " & Page & " of " & Total), txtRect, DT_CENTER Or DT_VCENTER Or DT_SINGLELINE Or DT_NOPREFIX)
Call DeleteObject(hFont)
Next i
Okay. Now, as I understand it that shouldn't make the computer run out of memory (256MB DDR I'm a lucky boy)
However, it does. What's wrong? I've delete the font after creating it, but in that System Resource monitor, that code reduces System and GDI resources to 0%.
(And BTW in the program there is no 'For i = 0 To 20000' thing, it's just to speed up the example)
The reason I ask is that is somebody does something a certain number of times (specifics available for a small fee) they shouldn't have Fixedsys imposed on them and all that 'Out of Memory' stuff.
So please help.
I've composed a little rap to express my emotions:
Sometimes it crashes,
Sometimes it will run,
Always faster, always more fun
But then there's the GDI
Why?
Who put that there?
Are you square?
Do you want me to find the fourth dimension and put you there?
Are you missing some genital hair?
Sorry. Raps aren't my strong point.
Me.
Proof That M$'s Code Is Iffy!
I've posted a link to
HOWTO: Simulate Visual Basic 6.0 String Functions in VB5
http://support.microsoft.com/support.../Q188/0/07.ASP
a couple of times before but I'd only used the Split() function before now.
I used the Replace() function last night and it goes into a loop!
Code:
nPos = InStr(nStart, sOut, sFind, bCompare)
Loop While nPos > 0
ought to be:
Code:
nPos = InStr(nPos + Len(sFind), sOut, sFind, bCompare)
Loop While nPos > 0
Bullet-proof Installations - Is It Possible?
***Note: I also posted this in the database forum ****
Creating a setup program for the last project I worked on was a nightmare. I tried three different setup packages, and none of them individually could create a reliable installation that would work on all Win platforms (95, 98, and NT - didn't try 2000). The setup packages were InstallShield Express 2.13, the PDW (everyone's favorite), and Visual Studio Installer 1.1.
The project used VB6 w/SP4 to connect to an Access 97 database (DAO 3.5), along with Crystal Reports 4.6 (the one that ships on the VB6 CD). For what it's worth, the FSO (Scripting object) was also used.
An InstallShield installation would go smoothly, but when the application ran, the error 429 (ActiveX could not create object) would come up. The Visual Studio installer could not register the Crystal Reports OCX during the install, and would also produce the 429 error when the app was run (I thought it was supposed to take care of that!). I was reluctant to let the PDW continue after it produced the message "Some system files are out of date - you must reboot to continue" - I had been burned by that a while back with the VB5 setup program (a user's machine was hosed); they may have fixed this in the VB6 PDW, but I'm not going to take that chance.
Although not an ideal solution, what finally worked was using a COMBINATION of two of these tools. I found that if I run the InstallSheild setup first, then uninstall the app, then install using the VSI or PDW setup on top of that, the app runs fine. But yecch - who wants to make the user run two install processes?
Any thoughts on what could have been done to make this smoother and not "confuse" the installers? Should I have used an Access 2000 DB instead of 97? Should I have accessed it via ADO rather than DAO? Should I have used the latest version of Crystal Reports? Or does none of that matter? Any opinions on what you can do to test and make sure you have a bullet-proof install?
I appreciate your input on this issue.
Validate A Program (Leak Proof)
Okay, I really need something like this, as leaking problems with my programs are getting quite high. Basicly, I just want something that will prevent the program downloaded from my site, being sent to anyone else. The program is free, but I would like the only place for it to be availible is at my site.
Anyways, here was my idea:
Generate a random key (I can do that)
Save the key to the computer (Can do that)
Next time the program is loaded up check if the saved key matched the key that was given when the program was first ran (Can't do that)
This should prevent leaking. Since, if someone on another computer tryed to open it, the check would fail, since the key was invalid.
Except, Im not sure this is possible, except with using an online database, like MySql or something, which I do not want to do. I may have to resort to it, but if it is possible to stay away from it, please inform me, as this is a good plus for my programs
Best Fool-proof Way To Input Time
Alright guys. I want a full proof way to enter time. I am using a mysql database, which *can* accept a time stamp. Don't know if VB supports it natively. I would like a simple user interface to assign a start time/end time. Which could in theory be military or standard 12 hour. If military (I've already created a converter which doesnt work right). I've tried masked edit, but I need something that will just work. Something that doesn't require pages of API calls and what not. Thanks a lot for the help.
Making A Program Tamper-proof
I have a program (BLAH.exe) that begins automatically at start-up, as I have added it to the registry. It is invisible in the taskbar and the task manager. I have a timer program running in the background, every second, that shuts down regedit.exe so the registry cannot be accessed. Now then....is there any way for someone to get to BLAH.exe? Have I left out any back door?
Errors And Data Proof Checking
hi everybody!!!
I have a dbgrid in my usercontrol what happens is when someone uses the dbgrid button click event it displays a combo box. When they select a item this is when i have problems:
1) The drop down combo box doesnt go away until you press the dbgrid button again. How can i get it to vanish selecting an item!
2)If they open the combo box but dont select anything and say click onto somewhere else it returns this error:
"row cannot be located for updating. Some values may have been changed since they were last read"
Then you press ok to it and it brings up errors on everything you do?
3) I need to be able to create a new line in the dbgrid on button press!!!
It seems i need to be able to validate the data the user enters!
Any ideas or help?
thanks heaps!
Beacon
Making My Program Error Proof.
This is kind of a repeat of a previous question, but this is from a different angle. Sorry!
I am writing a database application at the moment. I am really paraniod about error trapping (along with loads of other things!) and all that kind of stuff. My program has loads of error trapping code, but there's one eventually I can't account for. My program checks that the database (a Microsoft Access Database) exists when it loads up, and gives error messages if someone has deleted or moved it. However, what if the program loads, and then someone uses alt+tab or something to leave the program and delete/move the database. When they return, they may be able to avoid the error traps and cause the program to crash/mess up. How can I stop people from leaving my application unless they have used the exit button built into it? I figure I will need to disable alt+tab and de-active the start bar. I asked about hiding the start bar before, but the code didn't work!
Any suggestions?
(Maybe I don't need to do anything! If every form that uses the database has an On Error Goto DatabaseErrorHandler command in it's Form_Activate event, and the error handler is also in the activate event, would that not catch every thing? However, I would still like to hide the start bar, 'cos it obscures some of my larger forms slightly!)
Thanks very much,
Steve.
P.S. - no comments about the correctness (or otherwise) of my handle this time please!
DAO Form Example. Bullet Proof Data Integrity.
Good example included, please have a look...
On browsing the forum and the net, I see a lot of questions
relating to data integrity in a VB form.
It's an issue I come up against a lot myself - so here, I have attempted
to address some of the issues raised and provide a possible solution.
The form is designed around the DAO data reference.
It is an attempt to make a bullet proof data form in that . .
If the user changes the value in a field and then tries to
move to another record, or add a new record, or close the form or whatever . .
then the form will pick up the changes and ask if the user wants to save.
Its basically an attempt to make using DAO on forms safer for data integrity.
If anyone has any ways to improve this method, please post.
The find facility is a nice utility that I strung together from a mixture
of code from others and some of my own.
Clicking find will open a find form with a listview of all the records.
Click any header and the search bok at the top of the form becomes relevant to
the column that you clicked.
Enter a few characters in it and the listview will try to match and select
the first record it finds that matches your text.
Click on any column header to sort by that column no matter what the data type is.
This puppy will sort strings, dates, numbers, urls, yes/no, memo, ..whatever.
Click the columnheader again to sort in the reverse order.
Keys.
[Page Down] or [Arrow Down] = Move to next record
[Page Up] or [Arrow Up] = Move to previous record
[Ctrl & [Page Down] or [Arrow Down] = Move to Last record
[Ctrl & [Page Up] or [Arrow Up] = Move to First record
[End] = Move to Last record
[Home] = Move to First record
[Escape] = Close
[F2] = Find
Hope its useful to some
regards
GT
kieranstafford@utvinternet.com
Keywords:
Record changed
move to new record
detect record changed update updated
find record
listview
sort listview
using keyboard keys
DAO
Data object
Shellexecute
Fool Proof Way To Find Date Occurrences
Hi Everyone,
Is there a fool proof way of finding date occurrences with any given date. I currently have two combo boxes on a form along with a Date Picker control. In the first combo box I have the words, first, second, third, fourth, fifth, and last listed in it. In the second combo box I have the days of the week (Sunday, Monday, Tuesday, etc.) listed in it. What I would like to do is this. When a user selects any given day from the date picker I want the combo boxes to be filled with the correct occurrence of that date. For example, if the user selects October 12, 2002 from the Date Picker the first combo box will show "Second" and the second combo box will show "Saturday", respectively. Does anyone have any ideas on how to accomplish this so that it works correctly? I would appreciate any help. Thank you.
|