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




Detect A Empty Line


Hello ,

How to detect a empty line ?(no spaces and no characters)

Code:
Sub occurence()

Dim objWd1 As Range
Dim objWd2 As String
Dim bFound As Boolean

‘when I meet a empty line and that I regard in the spy window
'I see objWd1 " " range/range
'and objWd2 " " string

'If ((objWd1 = "") And (objWd2 = "")) Then
'If ((objWd1 = Empty) And (objWd2 = " ")) Then
'If objWd2 = " " Then
'If objWd1 = " " Then
bFound = False ‘I Need to trace this to exit my loop

End If

'I Have try this list of « if » without any effects .I never go inside the
'if to trace bFound
'etc code ....




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Empty Line In Datagrid With An Empty Recordset
I've a datagrid of which I connect the datasource to my recordset. But when the result of this recordset is empty, I get an empty line in my datagrid. Then if I try to display a new recordset, I get the error :

"Either BOF or EOF is True, or the current record has been deleted; the operation requested by the application requires a current record."

So the system want to update my data, but the data doesn't exists.

Does somebody know how I can prevent getting an empty line with an empty recordset ?


Thanks!!!

Greetz,Joris

Detect Empty Cell
I'm writing a macro ( actually 2 macros, one for character, one for numeric ) that allows the user to override an exsiting value calulated elsewhere in the spreadsheet. As a first step, I want to detect when/whether the user has entered a value or not.

I thought that something like

mycheck = IsEmpty(Override)
If mycheck = -1 ( or NULL ) Then .....

would tell me that when the user DID NOT enter something ( or had deleted what he did enter ). However, even when the cell is empty ( and confirmed by ISBLANK in Excel ), I can't detect when the cell is empty.

hope this isn't a really stupid queston .

thanks in advance for your help

regards
woody

Detect Empty Array
Hi,
In VB.NET I can detect if a string array is empty?

If MyArray IsNot Nothing Then ...

However, how can I do the same in VB 6?
Thanks,

Detect Empty Recordset
Just a quickie, I've been using the below code to check for an empty recordset. Just wondering if this is the best/most efficient method for doing so as its something I need to do a lot of (Lesson for noobs: Don't build an app around a database full of test data, I did this then came across loads of .bof/.eof errors when all the data was deleted as I hadn't accounted for empty tables!).

Current method of checking: -

Code:
If clientRecSet.BOF = True And clientRecSet.EOF = True Then
exit sub
end if
'carry on with function

Cheers

Detect If A .txt File Is Empty Or Not? Can It Be Done With VB 6.0?
Hello,

I have a .txt file in C:Plugins, and I was wondering how to detect if the file has any text in it or if it is empty?

I would appreciate any help you all may have!

Thank you!
Stilekid007

Detect Empty List Boxes
Is there a simple way to detect if a listbox is empty? Basically I have two list boxes, and I move data from one to the other and want to detect if one is empty. Any ideas?

Also how can I detect if in an array of checkboxes nothing has been checked?

Detect Blank/empty String
All,

I have a text file format like below (there's a blank space between Illinois, and John Lee)
Michael Smith
Victor, Kim & Company
ACCOUNTING/FINANCIAL SERVICES
United States
Illinois

John Lee
ABC Inc,
BROKERS
United States
Texas

I like to turn them into 1 string for each for each line.

Desire format:

Michael Smith xxxx Illinois
John Lee xxx Texas
Xxx and so on

But my VB code display one long string.

How Do You Detect A Rich Text Box Is Empty Or Not??
I have bound a rich text box that reads from datbase field, i need to check whether the RTF is empty or not in order to change some settings.

The database field has been saved in the RTF format already. I tried using the RTF.text function to detect whether the RTF is empty or not, but this only works if theres text in the box. If theres only a pic or some other object in the box this check fails. ANY ideas of what to do??

Empty Line Question
I'm about to make a program and it's going to read and write to a text file. The text file will hold some information about "something" and you will be able to create or edit the text file within my application.

But users might also open the text file and edit in notepad and then use it with my application. If they do that I don't have the same control over it as if it's created by my application.

In case someone makes an empty row in the file then I want that row to be ignored when my application reads the file but how do I make sure it's not read.

If the row is read and the string i get is "" then I guess it wont be any problems for me to check and ignore it but lets say that the user have made some "spaces" so if the row is read it's something like this " ". I still want that kind of row to be ignored.

Is there an easy way to check this?

Appending The Empty Line?
(First off, sorry about reposting this question in a new thread, but I don't think many people are reading my old thread anymore, I kindly ask a moderator to delete it from my other thread since I can't do it myself)

For my saving/loading routine, it seems to be adding a blank line to my saved data each time it saves if the control I'm saving is non-null.




Code:
Private Sub save_Click()
If (Dir("C:
com", vbDirectory) = "") Then
MkDir "C:
com"
End If
Kill ("C:
com
comnotes.txt")
Open "C:
com
comnotes.txt" For Output As #1
If (notes <> "") Then
Print #1, notes
End If
Close #1
End Sub

'loading

Private Sub Form_Load()
Dim loadnotes As Long
Dim data As String, Target As String
Target = "C:
com
comnotes.txt"
timer = Date + Time
Open Target For Input As #1
data = Input$(LOF(1), #1)
Close #1
notes = data
End Sub


I've managed to make it stop saving blank lines when the data is blank, but I can't think of a way to stop it if it's non-null.

Datagrid With Many Line But All Empty??
Hi
I have a datagrid in a form and it supposed to display the continue of a specific table call TblStatus.
In my datagrid I can see each line that represent a record but in these line it have only one column while it supposed to have 3.  And this columns and these lines are all empty. I look in the table and my records don't contain any blank fields.
This is my code

Private Sub Form_Load()
OpenDb
Set RsStatus = New ADODB.Recordset

   RsStatus.CursorLocation = adUseClient
   RsStatus.Open ("Select * From TblStatus"), MyConn, adOpenStatic, adLockOptimistic, adCmdText
   Set DataGrid1.DataSource = RsStatus
   DataGrid1.Refresh
   Me.DataGrid1.Columns(0).Visible = False
End Sub

Do you have an idea why it does this?
Thanks in advance

Trying To Find The Empty Line In Text
Sorry if this is a repeat I've looked through the faq's and searched for two
days but for some reason I haven't been able to figure this out.

I've got a little VB6 project that sucks in a text file of up to 5000
item descriptions from a pbem game that I play and is attempting to
put the full text into the appropriately numbered K cell of my spreadsheet.

What I'm stuck on isn't the Excel but in trying to parse the text file.
There is no rime or reason to the end of the description the only thing
that separates the text is a blank line.

I've tried using a vbCrLf, vbCr, and vbLf in my below InStr line but
nothing works it doesn't stop at the end of the first description it
just hits EOF and quits.

Does anyone have an idea they could throw my way that might jump
start my brain? Bellow is the offending sub and below that is two
descriptions from the text file. I"ve also attached the project with the
surrounding Excel formatting if anyone wants a good laugh at bad code
but I don't think that will matter it's just the I/O part I'm having problems with.

Thanks in advance,
- Brad


------------ VB6 code----------------------------------------

Code:
Public Sub TextData()

Dim buffer$, item%, a$, done As Boolean

item% = 1

Open txtfilename$ For Input As #1
done = False
Do While Not EOF(1)
Line Input #1, buffer$
If InStr(buffer$, item%) <> 0 Then
a$ = buffer$
item% = item% + 1
Do Until done = True
Line Input #1, buffer$
a$ = a$ + buffer$ & vbLf
If InStr(buffer$, vbCrLf) <> 0 Then
General.xlItem.Range("K" & item%) = a$
done = True
End If
Loop
End If
Loop
Close 1
General.xlItem.Range("K2:K5001").WrapText = False

End Sub
-----------------------------------------------------------------

---------text file example----------------------------------------
You inspect the item and discover that its essence is described in
its name.
This weapon is an Sword type weapon
It has a base AF bonus of 70% and a missile AF bonus of 0%
The charage bonus of this weapon is 10% and the rout bonus is 5%
The weapon can be used with a shield, and it can be used while mounted.
The wielder must have a strength of 6 and a dexterity of 6 to use this weapon
The weight of this weapon is 1.2
This weapon is magical by nature...
The terrain modifiers (overall) for this weapon are as follows:
Grassland : 0 Forest : 0 Hvy Forest : 0 Forest Hills: 0
Forest Mtns :-25 Barren Hills: 0 Barren Mtns : 0 Moors : 0
Swamp : 0 Desert : 0 Sea/Ocean : 0 Defend Walls: 25
Attack Walls: 15 In City : 0 Air : 0 Confined : 0
This weapon is not magically enhanced when used by a specific character or soldier.
This weapon grants a 0% AF bonus when the user meets these conditions:
NO Restrictions on use
This weapon is not a bane (no bonuses against specific target).
This weapon has no special attack value.
When in winternight, this weapon's AF will be modified by 0%
The following bonus will apply only if the restrictions for use are met.
Holy Mana available to Priests : 0 Holy mana recovery bonus: 0
Mana available to Arcane Arts : 0 Magic recovery bonus : 0
This weapon increases your magical attack resistance by 0 points.
Cost of Producing this Item is...
1 units of Iron
This will produce 3 Broadsword

2
Claymore Runepower gained on day 1 of January in the year of 1990
You inspect the item and discover that its essence is described in
its name.
This weapon is an Sword type weapon
It has a base AF bonus of 80% and a missile AF bonus of 0%
The charage bonus of this weapon is 20% and the rout bonus is -10%
The weapon may not be used with a shield, and it may not be used while mounted.
The wielder must have a strength of 10 and a dexterity of 6 to use this weapon
The weight of this weapon is 2
This weapon is magical by nature...
The terrain modifiers (overall) for this weapon are as follows:
Grassland : 25 Forest : 0 Hvy Forest : 0 Forest Hills: 0
Forest Mtns : 0 Barren Hills: 0 Barren Mtns : 0 Moors : 0
Swamp : 0 Desert : 0 Sea/Ocean : 0 Defend Walls: 15
Attack Walls:-25 In City : 0 Air : 0 Confined : 0
This weapon is not magically enhanced when used by a specific character or soldier.
This weapon grants a 0% AF bonus when the user meets these conditions:
NO Restrictions on use
This weapon is not a bane (no bonuses against specific target).
This weapon gives a bonus of 25 when fighting against mounted enemies
This weapon has no special attack value.
When in winternight, this weapon's AF will be modified by 0%
The following bonus will apply only if the restrictions for use are met.
Holy Mana available to Priests : 0 Holy mana recovery bonus: 0
Mana available to Arcane Arts : 0 Magic recovery bonus : 0
This weapon increases your magical attack resistance by 0 points.
Cost of Producing this Item is...
1 units of Iron
This will produce 2 Claymore
-----------------------------------------------------------------

Word - Empty Line Deletion
I have a word document that is full of line feed characters. I want to shorter the length of the document by getting rid of all of the extra line feed characters between the paragraphs. I am new to VBA in word, so I was wondering how to loop thru and tell it to delete if the line has no characters. I know how to do this in cells in Excel, but Word seems to work a little differently.

Thanks!

Without Empty Line At Begin Of TxtFile
When I use this:
Code:
Private Sub Command1_Click()
Open "C: ext.txt" For Output As #ff
Print #ff, Text1.Text
Close #ff
End Sub
It print at the beginning of the Textfile an empty line.
My question is how can I save it, without this empty line.
Is there an API Call?

Thanks in advance

Search Untile Empty Line
small Q1:
how can i stop searching a .txt file if i reach an empty line?


small Q2:
if i got what i'm searching

VB Code:
If UCase(Left(tmp(x), 14)) = Text3.Text Then

how can i add a char ,for example ">" in position 15 in the file

Need Help - How To Add An Empty Line And Text To The Exists Document
Hi,

Please help me to solve the problem.

I want to add some text to the Word document which already contains some text lines. I have to add a empty line before adding this text.
and the existing document text also not fixed. Some of the Parameters are coming through Parameters. But for my task I have to add the text dynamically at the end of the document text.

I am thankful to you in advance.

Losing That Last Empty Line With Print #1, TxtT.Text;
Did you know that if I have this code:


Code:
Open FName For Output As #1
Print #1, txtT.Text;
Close #1
And I'm saving a text box with lots of text and then a curor on the final line all by itself, I end up losing that final, empty line?

It works perfectly if your cursor is at the end of a line with some text, but if the user wants some blank lines at the end, they end up losing those blank lines one at a time with every save.

Get rid of the semi-colon and you add a vbCrLf to the last line with every save.

Is there a work around without reverting to Line Print?

How To Detect The End Of Line?
Hi, I'm new to VB and this forum, I'm working on a program that to check the validity of a text file.

The elements in the text file are in integer type and i'm going to assign all elements in text file into an array.By:

Open "c:map.txt" For Input As #1
Do While Not EOF(1)
Input #1, map(x)
x = x + 1
Loop
Close #1

However it takes all the elements into an array without notifying the line separation between elements.


I'd very appreciate if anyone could help me with this.

Thanks you
Redbean

Detect If Line Is In Use
I have to make a call using a modem and MSComm and I would like to be sure no one is on the phone before calling.

Right now, when the phone is open, the modem is beeping like a busy line but I would like to detect it before sending the output.

Is there a way to do it ?

Line Detect In RTB
How do i detect wich line i am on in an RTB ??
Like in word etc.

Thanks in advance

How To Detect Line Click
I need to detect the user clicking on a line drawn with the line tool. I have attempted to use invisible image objects to detect a line click, but the click has to be too sensitive with an image box. Is there any other way aside from this, or 2d math to solve this problem?

Detect A Passthrough A Line
Imagine you have a programmatically rendered gaphic in front of you drawn on a form or a picture box by your own program code. This graphic consists of a number of glyphs, some of them linked with straight lines in between them. When you move the graphics, you have programmed them to repaint the entire graphic in the MouseMove in such a manner that the entire container is repainted so that they all behave well as in the graphic being moved invalidate any regions behind it to have them repainted from a source graphic.

You have coded this feature to repaint any obscured glyphs behind the glyph being moved. Now its the turn to repaint link-lines obscured behind the glyph being moved. How would you determine, when a glyph is being dragged, whether a particular portion of a given line (given the X,Y of the line) is currently obscured by the glyph?

How To Detect New Line Character?
hello guys,

Can anyone tell me how can i find new line character from the text file. what
i want to do is.....
from a text file i want read the characters one by one till the end of line.
As the end of line encounters i want to stop reading. I have tried to do this by using the while loop. But the problem is loop continues for infinite time.
I have used file system object for this purpose

Can Any One Help me?

Detect A Passthrough A Line
Imagine you have a programmatically rendered gaphic in front of you drawn on a form or a picture box by your own program code. This graphic consists of a number of glyphs, some of them linked with straight lines in between them. When you move the graphics, you have programmed them to repaint the entire graphic in the MouseMove in such a manner that the entire container is repainted so that they all behave well as in the graphic being moved invalidate any regions behind it to have them repainted from a source graphic.

You have coded this feature to repaint any obscured glyphs behind the glyph being moved. Now its the turn to repaint link-lines obscured behind the glyph being moved. How would you determine, when a glyph is being dragged, whether a particular portion of a given line (given the X,Y of the line) is currently obscured by the glyph?

Detect Change In Line
I'm using Rich text box control. How do i do something when the user have move the cursor to another line?

Detect Line, Delete
in a text box I have the following command sent to me:

1003 LEAVE Gamerbota#2 0010

I want to block all lines in a textbox that start with "1003".. how would i go about doing this??

sac

How To Detect End Of Line In Txt File?
How do you detect the end of the line when opening a text file with visual basic.

Because there doesn't seem to be a way to distinguish between data retrieved after a comma and data retrieved after a new line character.

Is there a flag or constant of some sort that can be used to signal the end of a line in a text file?

Receive Line Detect
I have written two VB applications(only prototypes at the moment) which run on separate PCs connected via comm port 1. One of the application performs a break event on its output line for a set duration. The other application can detect this using the OnComm error event. What I’m trying to do is time the duration of the break on the receiving PC. The problem is there’s no event that detects when the break on the line is removed. I have an idea that I may be able to use an API call to detect the status of the receive line but I fear this may take to long as the time scale is in milliseconds. The serial cable used only consists of an input, output and gound. Therefor I can't use the Carrier Detect and other similar properties. I’d be much obliged if you can help.

Elroacho

Detect A Passthrough A Line
Imagine you have a programmatically rendered gaphic in front of you drawn on a form or a picture box by your own program code. This graphic consists of a number of glyphs, some of them linked with straight lines in between them. When you move the graphics, you have programmed them to repaint the entire graphic in the MouseMove in such a manner that the entire container is repainted so that they all behave well as in the graphic being moved invalidate any regions behind it to have them repainted from a source graphic.

You have coded this feature to repaint any obscured glyphs behind the glyph being moved. Now its the turn to repaint link-lines obscured behind the glyph being moved. How would you determine, when a glyph is being dragged, whether a particular portion of a given line (given the X,Y of the line) is currently obscured by the glyph?

How To Detect Line/Set NewPage In Word With VB?
Hi there to all!

Does anybody know how to detect the exactly line number of a string in a Word document? I have a Word document that is called from a VB program.

My problem is: I need to detect the line number of a string in this document, and I need to set NewPage if this line no is greater than 30.

Can I put this command inside Word document? Is there a way to detect it with VB?

Thanx! Best regards!

Mscomm1 Line Picked Up Detect
hi all

i'm using mscomm1 to dial through an attached modem which works fine. but now I need to detect whether the phone line has been picked up or hang up...

how can I do this

mscomm_onComm() does not seem to work...

thanks

Detect If A VB Line Exists In The Program?
Hello,

How can I tell whether or not a vb line exists on my form? once the program is compiled (To see if the user drew a line)

Thank you!!

Stilekid007

MsComm: Change In Carrier Detect Line
Hey guys,

I am coding software for a remote control. The infrared receiver is connected to a serial port on one of my machines. I am trying to read data coming in over the COM1 port using the MsComm control.

Unfortunately, whenever the OnComm event fires, it is CommEvCD, or, a "Change In Carrier Detect Line". The following is my OnComm Code:


Code:
Select Case s.CommEvent
Case comEvReceive
s.InputLen = 0
Me.Caption = Me.Caption + 1
'Dim d() As Byte
d = s.Input
tIn.Text = tIn.Text & s.CommEvent & " @ " & StrConv(d, vbUnicode) & vbCrLf
Case comEvCD
tIn.Text = tIn.Text & "Change in Carrier Detect line." & vbCrLf
Case Else
End Select

Every time I press a button on the remote control, anywhere between 20 and 80 CommEvents fire, all being Change in carrier detect lines. Here is my MsComm config:


Code:
s.CommPort = 1

If s.PortOpen = False Then
s.PortOpen = True
End If

s.Handshaking = 0
s.RThreshold = 1
s.SThreshold = 1
s.Settings = "9600,N,8,1"
s.InputLen = 0
s.Handshaking = comNone

Anyone know what the problem could be? Thanks!

Execute Command Line And Detect When It Ends
hello again
I have this code to execute an external command line wich work perfectly. The problem is that i want to execute it in hidden mode.
With shellexecute i can easly do this but it get's complicated to now when it finishes. how can i do it using this sub?
any help?
thanks

Public Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type

Public Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type

Public Declare Function WaitForSingleObject Lib _
"kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds _
As Long) As Long

Declare Function CreateProcessA Lib "kernel32" _
(ByVal lpApplicationName As Long, ByVal lpCommandLine As _
String, ByVal lpProcessAttributes As Long, ByVal _
lpThreadAttributes As Long, ByVal bInheritHandles As Long, _
ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, _
ByVal lpCurrentDirectory As Long, lpStartupInfo As _
STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) _
As Long

Declare Function CloseHandle Lib "kernel32" (ByVal hObject _
As Long) As Long

Public Const NORMAL_PRIORITY_CLASS = &H20&
Public Const INFINITE = -1&

private sub ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim ret As Long
'Inicia a strutura STARTUPINFO
start.cb = Len(start)

'Inicia a aplicação escolhida para ser executada
ret& = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)

'Aguarda a aplicação iniciada terminar
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
ret& = CloseHandle(proc.hProcess)
End Sub

private sub cmdZip_Click()
ExecCmd tempdir & "winzipwzzip.exe -a c:encartadeiramidesa.zip c:encartadeira*.txt" '----- How do i execute this in hidden mode?-----
end sub

How To Detect When Mixer Line Is Opened For Record
Windows Mixer starts the VU Meters when I press the Record button in the Windows Sound Recorder. I wonder how my program could do this??

Apart of the normal mixer functions, sndvol32.exe have references for only three wavein functions: EnumDevs, GetDevCaps, and Message. How they can do it with only those??

DETECT AND RECORD SOUND TO WAV FILE FROM LINE IN
My question is If i can record audio from line in via visual basic andmci control.
Is anybody know how can i make the recording to start automatically whena sound is detected and stop recording after a period of silence.

Thanks!

Modem Can Not Detect Line Busy Status
Hi,

I have created a auto-dialing system which play recorded wave message.
All works fine.
Only problem it can not detect line busy status.
I am useing coexant DFM 56000 bps Data/Fax/Voice Modem

Please give me solution

Detect DTMF Tones And Recording Wav Files On Telephone Line
Please tell me how to detect dtmf tones in vb. in English language.
The telefonito.zip is in spanish which i am not able to follow.
Any other code in English is welcomed.
H.Bhatnagar.

How To Print To A File Without Getting An Empty Line At The Bottom Of The File
I have a problem making a fixed formatted textfile with data from database.
I use print/write and they put CR+LF to the file.
The file gets an empty line at the bottom.
I want the file end direct after the last character in the file.
Help me please to solve this problem.

/lava

Sorting A Table In VBA To Delete Empty Rows And Shift Empty Columns
 Problem is:

1a. Have a table, it may vary with regards to RxC.
1b. The first column always contains a company name. The final column always contains a count (zero or a number > zero).
1c. Every other column either contains text or a zero.

2. I want to delete all the rows where the final column = zero
3. I then want to go through each column of each remaining row and where the cell is =0 delete the cell and 'shift cells left'

A table may help to show what i have:


CompanyNames Field1 Field2 etc.... FinalColumn
==================== ==== ==== ====
BusNameA, text1, 0, 0, text4 ... ... ... 2
BusNameB, 0,0,0,0 ... ... ... 0
            ... ... ...
BusNameE, 0, text2, 0, 0 ... ... ... 1


And I want the table to show


==========
BusNameA, text1, text4, 2
BusNameE, text2, 1

Gurus, kindly tell me how i may do this?

Steve

 

Empty Line = "premature" EOF ?
...
Nevermind, there was no error.
Cheers

Urgent : Create An Empty Recordset And Validate A New Empty Array
Hi everyone,

I'm new in this kind of development.

I need to create an empty recordset, just to create an empty shell with a structure (not a data type). So, I'm trying to 1. Open it 2. Adding new row then with the addnew method.

Also, I need to validate a dynamic array before adding records to the recordset.

Thanks everyone.

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

Dealing With Empty Fields And Empty Search Critera
I'm creating a database where not all the fields will contain information. Specifically, I'm making a database of materials and their properties. Some properties don't apply to all materials or are difficult to find, so they are blank. For example, I've been unable to track down the electrical resisitivity of acrylic.

I've also set up a search dialog box and an SQL statement to search between user-entered values for all the different properties. I'd like the user to be able to search for all the properties at once (ex: search for a material with a yield strength between 20 and 30 AND a dielectric constant between 1 and 3 AND a density between 1.2 and 1.5, etc.) but still be able to search for the materials when the user enters no value in to the search dialog box. With what I've done so far, the user must enter critera for all fields for the query to return any records.

I tried the following code, but it isn't working. Sigh. Any ideas? (The error message is after the code.)

Code:
Private Sub btnSearch_Click()
Dim sqlMatlSearch As String
    sqlMatlSearch = "SELECT * FROM [tblMatlProps] WHERE"
    
    If (Not IsNull(Me.DensityLower)) And (Not IsNull(Me.DensityUpper)) Then
        sqlMatlSearch = sqlMatlSearch & "(Density Between " & Me.DensityLower & " AND " & Me.DensityUpper & ") AND "
    Else
        sqlMatlSearch = sqlMatlSearch & " Density > 0 "
    End If
    
    If (Not IsNull(Me.GlassTransitionTemperatureLower)) And (Not IsNull(Me.GlassTransitionTemperatureUpper)) Then
        sqlMatlSearch = sqlMatlSearch & "(GlassTransitionTemperature Between " & Me.GlassTransitionTemperatureLower & " AND " & Me.GlassTransitionTemperatureUpper & ") AND "
    Else
        sqlMatlSearch = sqlMatlSearch & " GlassTransitionTemperature > 0 "
    End If

    DoCmd.RunSQL (sqlMatlSearch)


This code produces this error: Run-time error 3075: Syntax error (missing operator) in query expression 'Density > 0 Glass Transition Temperature >0'.





Edited by - CcSteff on 7/20/2004 7:28:38 AM

Empty Cells That Aren't Really Empty
I am using the code below to delete empty rows in a sparse spread sheet. This works fine for most of the worksheets but does not work on one. Even though all of the columns in a given row appear blank there seems to be something invisible in the cell that returns 11 items when the formula Application.CountA(Rows(r)) is evaluated. If I first select the row and apply "clear contents" then the macro below works on that row. If I set a watch point on the cell, I see a value of "..." (without the quotes). After I "clear contents" the "..." is gone. The "..." is never visiable on the spread sheet either in the cells or in the edit window. Does anyone know either
1. How I can detect these cells from the macro
2. How I can make sure the empty cells are really empty before running the macro.

Sub DeleteEmptyRows()
Dim LastRow As Long, r As Long
LastRow = ActiveSheet.UsedRange.Rows.Count
LastRow = LastRow + ActiveSheet.UsedRange.Row - 1
Application.ScreenUpdating = False
For r = LastRow To 1 Step -1
If Application.CountA(Rows(r)) = 0 Then Rows(r).Delete
Next r
End Sub

thanks,
Keni

Line Input #1, Line...how Do I Read Ahead One Line (or Back Up One Line)
I am loading a file line by line using the LIne Input but at one point i need to look ahead at the next line to decided what to do on the current line...how do i look ahead one line? or how do i use the line Input function and then back up? Any help would be greatly appreciated.

Shane Thomas
p.s. please email replys in addition to the reply of post too
shathoma@nmsu.edu

Detect SMTP Server And Detect E-mailaddresses From My MSN Messenger Contactlist.
does anybody know how I can make a program that automaticaly sends an e-mail to my full msn list ...

I allready know how to send E-mails ...

But I don't know yet how to get a list of all the e-mailadresses of your msn messenger contactlist.

And I also have a problem with automatically detecting the SMTP-server. (If I want to E-mail something using Visual Basic ... I always need to set my SMTP-server and I don't like that anymore. There should be a way to automatically detecting it)

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