Saving Textbox With Todays Date
I am trying to save the text in a textbox with the with the current date automatically updated every day by simply clicking a button
This is what I have but it doesnt work
visual basic code:--------------------------------------------------------------------------------Public Function SaveText(Text1 As TextBox) As Boolean Dim hFile As Integer Dim sFileName As String
On Error Resume Next hFile = FreeFile sFileName = App.Path & "C:" & Format(Now, "yyyymmdd") & ".txt" Open sFileName For Output As #hFile Print #hFile, Text1.Text Close #hFile End Function
Private Sub Command1_Click() Call SaveText(Text1) End Sub
Private Sub Text1_Change()
End Sub --------------------------------------------------------------------------------
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Saving Text With Todays Date
I am trying to save the text in a text box as for example "20050511.txt" for todays date. I want the date to update automatically and I want the file to save when I click a command button.
Please help if you can
Q.1 - Adding Todays Date To The Write File When Saving And Q.2 - Appending
I would like to know if I could add a statement to the write command somewhere in the following code, so the file would write Todays date at the end in date format MM/DD/YY:
As the text in my write file looks like this:
"Flower - Lilac",2,5.22,10.44
Could I get it to add TODAYS date automatically to read
"Flower - Lilac",2,5.22,10.44,03/07/04
My code now reads:
**************************************************
Private Sub cmdWriteQuotation_Click()
Dim pintCurrentItem As Integer
Dim pstrFileName As String
Dim psngTotal As Single
pstrFileName = _
InputBox("Enter the filename", "Write File")
If pstrFileName <> vbNullString Then
Open pstrFileName For Output As #1
For pintCurrentItem = 0 To _
lstQuotedExtPrice.ListCount - 1
Write #1, _
lstQuotedProduct.List(pintCurrentItem), _
Val(lstQuotedQty.List(pintCurrentItem)), _
Val(lstQuotedPrice.List(pintCurrentItem)), _
Val(lstQuotedExtPrice.List(pintCurrentItem))
Next
psngTotal = 0
For pintCurrentItem = 0 To _
lstQuotedExtPrice.ListCount - 1
psngTotal = psngTotal + _
lstQuotedExtPrice.List(pintCurrentItem) * 1.06
' Above line computes Sales Tax directly into total
Next
txtTotal.Caption = Format(psngTotal, "Currency")
End If
Close #1
End Sub
****************************************************
Also, when I pull this data into an Access Table it leaves the .44 off the total price of 10.44 as from the line below: why?
"Flower - Lilac",2,5.22,10.44 (It pulls the 5.22 just fine, but the 10.44 it gives me 10)
Also someone told me how to append the write file here earlier by using the Append command with the For statement, but can't get that to work...could someone give me a clue how to change this Statement to append all new input to the same text file.
My existing code is above and if you can show me how to use the append command I'd sure appreciate this too...
Thank you
NMP
Checking For Date In Access File And Compairing It To Todays Date...
Hey all, i am stuck at this point in my program.
I need the program to load up my access table and check for the date of orders:
each record has a field called PickUp and its formatted like "sat 1/1/2004".
When the form loads up, i need it to check that field and the computers date and if its the same, place the record into the list view. Keep going down the list til EOF.
Any help would be great.
Thanks for your time,
David
Still Having Probs With Select Statement Where Date = Todays Date
Hi Guys
I am using vb6.0 connecting to a SQL database (runningMSDE)
I am trying to load all contacts where the recontactdate is today
I have tried the following but am getting the error - syntax error converting datetime to character string - please help!
my code -
onload - dtpicker1.value = date
(tblcontacts.dtmrecontactdate is date/time)
Set adoduecallbacks = New Recordset
adoduecallbacks.Open "Select * from tblcontacts where dtmrecontactdate = ' " & DTPicker1.Value & "%" & " ' ", db, adOpenStatic, adLockOptimistic
- Please help!!!
Thanks
Problem With SQL Date Query (Todays Date)
Hi there,
Having a problem getting an SQL query to work when searching a database for todays date (basically a reminder package).
Here's the query
Set MyRecSet = MyConn.Execute("SELECT CoxRef, CompanyName, ContactName, postcode, tel FROM Reminders WHERE ReminderDate = #(date)# ")
Have tried all sorts of different things such as '&(date)&'") etc.
Only works when I type the date in like so .. WHERE ReminderDate = 15/02/2005
Any ideas please ?
Seymour
Compair Todays Date To A Date On File
Code:
Public Sub CheckExpire()
sb.Panels(1).Text = "Checking For Expired Membership!"
Dim B
Dim A
B = 1
A = 1
Do
If sb.Panels(2).Text = list.TextMatrix(B, 5) Or sb.Panels(2).Text > list.TextMatrix(B, 5) Then
If list.TextMatrix(B, 1) = "" Then
Exit Do
Else
Form2.Show
Form2.list.TextMatrix(A, 1) = list.TextMatrix(B, 1)
Form2.list.TextMatrix(A, 2) = list.TextMatrix(B, 2)
Form2.list.TextMatrix(A, 3) = list.TextMatrix(B, 3)
Form2.list.TextMatrix(A, 4) = list.TextMatrix(B, 4)
Form2.list.TextMatrix(A, 5) = list.TextMatrix(B, 5)
Form2.list.TextMatrix(A, 6) = list.TextMatrix(B, 6)
B = B + 1
A= A + 1
End If
Else
B = B + 1
End If
Loop
A = A - 1
sb.Panels(1).Text = "Check Complete, " & A & " Found To Be Expired!"
End Sub
Humm? 0 Found, I Added 1 With A Expired Date, Ideas?
Edited by - catacomb on 8/29/2003 11:00:16 AM
Go To Todays Date Row
Hi-
I was wondering if anyone could help me write a macro that when clicked on would take the user to todays date.
My spreadsheet is set up with every date from now until 2010 on the left column.
I want a feature where you click on a button an it takes you to (maybe even highlights that row) the current date.
Any help would be appreciated. I have never used VB or macros before.
thx
matt
Todays Date
is there a way to have a caption display todays date?
How Do I Insert Todays Date Using Sql
I have an access table and I want to insert today's date into one of the field. What is the correct syntax.
This is not working:
Dim todaysdate as String
todaysdate = format(Now,"m/d/yy")
Insert into table(Date)Values(todaysdate)
Thanks
List ALL Files For Todays Date
Hi,
Can someone please help me with the following request.
I wish to list all file names on my hard disk that have a last accessed/modified date of today - this includes all subdirectories
from the root directory.
Thanking you in advance.
Cheers,
Kevin
Adding Days To Todays Date
I want to add x amount of days to todays date. The number of days is held in an integer variable...how would i do it????
Inserting Todays Date With Button
I am v new to this VBA lark so be kind :-)
I have three cbo's - dd, mm, yyyy and what I want is a button next to the date dropdowns so you can click 'today' and it fills out the dd/mm/yyyy with todays dates.
I currently have this cbo code :-
With cbodd
.AddItem "01"
.............
.AddItem "31"
End With
With cbomm
.AddItem "January"
.............
.AddItem "December"
End With
With cboyyyy
.AddItem "2004"
.............
.AddItem "2008"
End With
Any help/pointers very welcome!
Thanks
Pete
Edited by - petebrooker on 6/22/2004 10:10:00 AM
Reading Todays Date / Display Data
I'm writing a small address program and wish that it will display a list of birthdays/anniversaries that are happening 'today' when the form loads.
As I have the control version of VB I am unable to read from a database, so I thought that I would just list them - but can I get VB to read a list and recognise 'todays' date?
A direct to research would be helpful, Cheers
FIXED!!! Display Todays Date <Access>
< edit > I got it working...
How do assign today's date to a text box? I tried searching around here before posting a simple question.
Here is what I have:
Code:
Private Sub order_date_BeforeUpdate(Cancel As Integer)
order_date.Value = Date
End Sub
Edited by - SubPar_Coder on 9/15/2004 3:00:46 PM
Monthview DayBold Works, But Resets To Todays Date.
This is a pretty easy task I think, but I wanted to run this by everyone on the forum.
My program revolves around a monthview control. The user clicks the date they want to work with and off they go. What I'd like to do is have the monthview control show the days in bold where data has been entered into the database. That way the user can see at a glance (one month at a time) where they've entered data.
I think the easiest way to do this is to find the first and last day of the month their working in then run a query that selects distinct dates from the database where they fall in between the first and last days of the month. At that point I can loop through and say if there is a match, bold the day...if not, move to the next day.
So I guess all I need is how to find the first and last days of a month based on where the user is currently sitting in the monthview control.
Getting Todays Year
hi
how can i get the YEAR - like 99,
so that if i had someone's Age - i could work out their D/O/B?
thanks
r
Given Todays Computers What Are The Limitations Of VB W/ DX?
Just wondering, Im new to the whole VB scene and was wondering what if any limitations exist with VB and DX given todays computers. My two main interests are 1st person shooters and terrain engines. All 3d of course, are these things going to be possible with VB? I see tons of games that people make on the forum, which are very cool btw, but they are all 2d. All the ones i see anyway, is this because vb sucks for 3d?
My ultimate goal is too have a joyriding game where you can choose a small plane or a car and take joyride over a troical island or something to that effect. Is this something I can someday expect to do with VB and DX?
Thanks
edit: Sorry typos.
Need Help For Saving Textbox As .nfo
He,
I´ve read a lot about this subject, but nothing works;
I want a save dialog for a textbox, so the user can choose a path, but the extension must be .nfo.
(Save button: cmdSAVE
textbox : cmdNFO)
Please help
TIA, Rob
Saving A Textbox
Is there anyway to save data to a text box? I am trying to save a textbox becasue I cannot use an RTB. I need some help please. I cannot find the command to save the file or open it into/from a textbox. Please help.
Thanks in advance,
MikeJ
Saving From Textbox
I need to save to a file something from a textbox and to be able to read from it everytime the program starts basically for a password thing. I will have a username and password at the beggining of my program. once someone gets into it there's a section where to change it. you know it does the "enter old password" thing then new password twice. I want to be able to save from the newpassword textbox (called newpass) to a file so that the next time a person logs in they have to use the password in that file.
So what I need is :
1. how to save from a textbox to file
2. how to read from the file at the beggining of the program and compare the file to what the user typed as a password.
I know passwords should be encrypted, but this is just for my own practice so I'm omitting that part.
thanks fro any help. - As you can see I'm a newbie to this forum and VB so I appreciate any help.
Textbox Saving
I have looked through all I could find on saving values in a textbox. It works but not what I'm looking for. Baiscally I want to have these textbox fields to have a value right when the program starts (i.e. IP Addresses), and if need be be able to change them and then send the program back out to the people that use it.
Saving A Message With Its Sent Date.
hi! Please help!
Currently, I am using the Application_ItemSend event handler to catch every outgoing mail. Based on the subject heading, the Email is saved to a folder on the computer, using:
item.saveAs
eg: If the subject heading has Uni - Lecture 14, then it is saved under the folder Uni.
This works fine and all. Unfortunately, the problem is that the messages are saved before they are sent. Hence the saved messages do not have a sent date and a message appears indicating that it hasn't been sent.
How do I fix this?
I've checked out heaps of websites and no one seems to find a solution.
The outlook mailitem object has two properties:
sent and sentOn. However, these are both read-only and hence I can't change them manually. Furthermore, there seems to be no event handler for AFTER the message has been saved.
Surely surely surely one of you brilliant guys can see a way out of this?
Date Format Changes When Saving
Hi
I've searched the forums here and can't find a specific solution.
I'm saving a sheet as a csv file. The sheet has a column of dates which is formatted to dd/mm/yyyy.
When I save the sheet as a csv manually I get the dates in dd/mm/yyyy format.
When I save the sheet using the vb code I get the dates in mm/dd/yyyy format.
If it helps any, here's the line of code that's doing the saveas
xDataSheet.SaveAs FileName:=sLoc, FileFormat:=xlCSV
I need to have the dates in a specific format for the next phase to work correctly, anyone got any ideas why it changes and / or what I can do about it
Any help much appreciated as I can't afford to lose any more hair
TIA
Dave
Saving As Yesterdays Date
Okay,
I have some excel set up to build timesheets for 5 employees. I have templates with the hours and everything already in the sheets. I have a macro that changes the dates on the sheet to todays date minus a number that I have entered in a user form. So lets say as it is monday I put a -1 in the user form and use this code to change the date.
Code:
Range("N8:N9").Select
ActiveCell.FormulaR1C1 = "=NOW()" & TextBox2
I do this because we use a date that is a weekending and the week ends on sunday for payroll. I can build the sheets on a tuesday if monday was a holiday by simply putting a -2 or I can build them on friday by putting a +2. This system works great.
I have another userform that asks for the weekending date to use in the saving of workbooks. So I use this code
Code:
Windows("jondoe-timesheet.XLS").Activate
ActiveWorkbook.SaveAs Filename:= _
"C:Time Sheets" & TextBox1 & "-jondoe-timesheet.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
ActiveWorkbook.Close
This works great also and give me a filename of 09-12-04-jondoe-timesheet.xls
My question is how can I make it save as todays date + or - textbox2?
I have tried this
Code:
sfiledate = Format(Now, "mm-dd-yy") & textbox2
but just get a filename like 09-13-04-1-jondoe-timesheet.xls
as you can see it doesn't take the -1 off the date it just appends the -1 to the filename.
Please help.
Saving A Date-variable
Hi,
I want to save a date-variable that stores a date in the format: dd/mm/yyyy in a linked access-database. But in the database the date is stored in the format: mm/dd/yyyy. How can I solve this problem??
Thanks..
Trouble Saving SQL Date
Here at work they wanted me to add a checkbox to a trio of radio buttons. The choices currently being radio1 or radio2 or radio 3, but not I need to add a check box so the choices would be radio1 or radio2 or radio3 and check1 yes/no. I've included a copy of the radio and checkbox statement along with the odd save statement the previous programmer has made, any help to get the data from checkbox to save from a1, a2, a3, etc. to a1c, a2c, a3c, etc. would be GREATLY aprpeciated
/////////////////////////////////////////////////////////
function writeICRSQuestion(i,oSection,oRS)
/////////////////////////////////////////////////////////
{
var iCount = i + 1;
var vFieldVal = null;
%>
<tr>
<td style="FONT-SIZE:12">
<%=iCount%>
</td>
<td style="FONT-SIZE:12">
<%=oSection.aQuestions[i]%>
</td>
<td style="FONT-SIZE:12" align="right">
<%
sFieldName = oSection.cLtr + iCount;
if(oRS){vFieldVal = oRS(sFieldName).Value;}
%>
<input type="radio" id="<%=sFieldName%>" name="<%=sFieldName%>" value="1" <%frmChecked(1,vFieldVal)%>>Yes
<input type="radio" id="<%=sFieldName%>" name="<%=sFieldName%>" value="2" <%frmChecked(2,vFieldVal)%>>Needed
<input type="radio" id="<%=sFieldName%>" name="<%=sFieldName%>" value="3" <%if(Request("rec").Item){frmChecked(3,vFieldVal)}else{Response.Write( "CHECKED");}%>>N/A
<input type="checkbox" id="<%=sFieldName%>C" name="<%=sFieldName%>C" value="4" <%frmChecked(4,vFieldVal)%>>QI
</td>
</tr>
<%
}
/////////////////////////////////////////////////////////
function saveICRSurvey()
/////////////////////////////////////////////////////////
{
var oDB = new objDB();
oDB.DBConn();
oDB.DBOpen(this.sTableName);
/////////////////////////////////////////////////////
//ALL CONTROL NAMES = DB FIELD NAMES-->USE THEM TO
//EASILY SAVE INFO
/////////////////////////////////////////////////////
//is this a new record or update to an already existing record?
if(Request("rec").Item)
{
oDB.oRS.MoveFirst();
while(oDB.oRS("id").Value != Request("rec").Item)
{
oDB.oRS.MoveNext();
}
}
else
{
oDB.oRS.AddNew();
}
//record loop
for(var i = 1; i < oDB.oRS.Fields.Count; i++)
{
if(oDB.oRS.Fields(i).Name == "Client")
{
oDB.oRS(i).Value = Number(Request(oDB.oRS.Fields(i).Name).Item);
}
else
{
oDB.oRS(i).Value = Request(oDB.oRS.Fields(i).Name).Item;
}
}
oDB.oRS.Update();
oDB.DBClose();
//get the id of the newly created record
var oDB2 = new objDB();
oDB2.DBConn();
var sSQL = "SELECT MAX(id) AS MaxID FROM " + this.sTableName;
oDB2.DBExec(sSQL);
var iID = oDB2.oRS("MaxID").Value;
oDB2.DBClose();
%>
<table>
<tr><td><center><p>
Your survey was successfully saved.<br>
To <strong><i>PRINT</i></strong> click here. You will need to enter the following number when prompted: <%=iID%>
</p></center></td></tr>
</table>
<%
}
Saving An Empty Date
how can you assign an empty text to a date type field and then save it?
ex.
fieldname is Bdate as date typefield
textname is txtBdate
code is: tablename![Bdate]=txtBdate
error is type mismatch
Saving A TextBox As A Txt File
Hi all.
I have a text box and a button on my form and when the button is clicked, I want the contents of the textbox to be saved into a txt file.
The code I have so far (that doesn't work is);
Code:
Dim strFF As String
Private Sub Command1_Click()
strFF = FreeFile
Open "C:Test.txt" For Input As strFF
Print strFF, Text1.Text
Close strFF
End Sub
I'm working with VB 6.0. I have tried using "write" instead of "print" but it keeps telling me that I need a '#'
Any suggestions?
Saving Textbox Text
I want to save the text in the textboxes. I have a program that has name country all that kind of stuff and I want to save it so I can open it later.
Thank you
Saving Text From A Textbox
Hi everyone,
Im completely knew to this site and it looks really good so far
Now to my question ...
I am trying to save something out of a textbox to a file, now to show you how and what i mean.
Basically the saving part works however, the opening part to it doesn't
When i try to save something similar to this:
blablablabla (this one here)
blablabla
blablabla
Only the first line gets opened and shown in the textbox the rest does not. However, all lines get saved in the file.
I am using a string comment to save it, now im not sure but i think that is the problem and the reason why it doesn't open it properly.
Code:
Private Sub mnuFileOpen_Click()
CommonDialog1.Filter = "Basic Math Calculator|*.bmc"
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
'Display the save dialog box
CommonDialog1.ShowOpen
'Display name of selected file
If CommonDialog1.FileName = "" Then
Exit Sub
End If
Open CommonDialog1.FileName For Input As #1
Line Input #1, strDisplay
txtDisplay = strDisplay
Me.Caption = Me.CommonDialog1.FileName
Close #1
Exit Sub
ErrHandler:
'user pressed the cancel button
Exit Sub
End Sub
Private Sub mnuFileSave_Click()
CommonDialog1.Filter = "Basic Math Calculator|*.bmc"
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
'Display the save dialog box
CommonDialog1.ShowSave
'Display name of selected file
If CommonDialog1.FileName = "" Then
Exit Sub
End If
Open CommonDialog1.FileName For Output As #1
Print #1, txtDisplay
Me.Caption = Me.CommonDialog1.FileName
Close #1
Exit Sub
ErrHandler:
'user pressed the cancel button
Exit Sub
End Sub
Does anyone have a solution?
P.S: Im still a little of a beginner to vb
Thx
Saving/Loading TO/From Textbox
I have 5 text boxes,
i want to input data into those (tooken care of already)
i want to
a) when i click a button, it outputs all the data into 1 text file
b) load that text file again into the program and have it displayed in its approitate text box
thank you
Saving/Opening From/To A Textbox
I have a text editor where I want to be able to save/open. I have a menu item called mnuFileSave (Under mnuFile), and the testbox is called txtMain. How would I go about doing this?
And, no, I can't use a Rich Text Box.
Saving ListView -> TextBox
I have a listbox, like the following:
http://www.freewebs.com/freestyler/Image.JPG
My listview is not this exact one, mine has just 2 collums, both just text. How would I save this to a single text file?
- - - -
I have save code, I just need to save the contents of the listview.
Thanks !!
Help - Saving Textbox To File
I have a sub to save a text box to a file, thats the easy part:
Public Sub SaveToFile(TB As TextBox)
Dim intFile As Integer
'Open up a save file dialog using the previous properties,
'except title
intFile = FreeFile
'Open will overwrite an existing file when for OUTPUT
Open myFileName For Output As intFile
' put the whole text box into the file
Print #intFile, TB.Text
Close #intFile
End Sub
I have a common dialog box attached to my form so I can change the font, size, and color of the text in the textbox. How can I save that information along with the text?
Thanks! I pretty much a n00b at this, so use small words
Saving Text In A Textbox
Ok. Hi ppl, I know how to open .txt files into a text box using the common dialog.....but could someone please tell me how I would go about saving the text in a textbox to a .txt file using common dialog??
Saving Textbox Contents.
Hi,
I'm a newbie, just wanting to know if there is any way, when a user enters a date into a textbox, can this date be saved as the default in the textbox, and when the form is reopened, the 'new' saved date will be shown, until such time as a change to the date is made which would then be the updated default?
Does that make sense?
Cindy
Saving Textbox To Database
Hi!
The problem is this:
There is a number with two decimals in textbox. I'm trying to save it to the database, but somehow the decimals are stored as integer.
And database adds two zeros to the end of the integer to be the decimals.
For example, the number in the textbox is 123,77. But after I saved it, the number in the database is 12377,00 And if the number is 123,70 the number in the database is 1237,00
The code is:
Sub SaveToDatabase(ctlNumber As TextBox, fldColumn As Field)
If ctlNumber > "" Then
If IsNull(fldColumn) Or ctlNumber <> fldColumn Then
fldColumn = ctlNumber
End If
Else
If Not IsNull(fldColumn) Then
fldColumn = Null
End If
End If
End Sub
Thanks!
Saving Textbox To .txt File
Ok. This may be a common question, but I did spend half an hour searching but everything was for listbox to text, excel in a textbox etc. etc.
I need just a simple thing, I want to save a textbox into a .txt file. Later open it back in the textbox.
Or if anyone managed to find a link that has it, pls post it.
Saving Multiline Textbox's
Ok well i know how to save but i was wondering how would i erase the contents of the file if it already exists adn put my new info in it. cause when i press the save button it saves over the old stuff only the first time i hit save. if i was to say hit save a few times then it would jst keep printing the info right after each other.
thanks for the help
if you need me to reword that jst ask and if you want the code for what i already have too.
BIG K
Saving Textbox Text To Txt
I was typing in another text box and it was changing it into binary and entering it into another text box.
|