Clear A Form

Apr 12, 2005

Hey all,

I have some code that looks like this to control a form;

Private Sub btnAdd_Click()
Dim UserName As String
Dim Initials As String
Dim Password As String
Dim OutlookName As String
Dim rst As DAO.Recordset

'Check each control, is their a value? if not, set focus to control
If IsNull(txtUserName) Then
MsgBox "You did not enter a new UserName nobby!"
Me!txtUserName.SetFocus
Exit Sub

ElseIf IsNull(txtInitials) Then ' return value of UserName variable;
MsgBox "You have not entered any initials for user: '" & Me!txtUserName & "'"
Me!txtInitials.SetFocus
Exit Sub

ElseIf IsNull(txtPassword) Then
MsgBox "You must create a password for user: '" & Me!txtUserName & "'"
Me!txtPassword.SetFocus
Exit Sub

ElseIf IsNull(txtOutlookName) Then
MsgBox "You must enter a Outlook name for: '" & Me!txtUserName & "'"
Me!txtOutlookName.SetFocus
Exit Sub

End If
' Pass the variables to the table.
Set rst = CurrentDb.OpenRecordset(("Users"), dbOpenDynaset, [dbSeeChanges])
With rst
.AddNew
![User] = Me!txtUserName
![Password] = Me!txtPassword
![Initials] = Me!txtInitials
![OutlookName] = Me!txtOutlookName
![Level] = 1
![Select] = 0
![dummy] = Null
.Update
.Close
Set rst = Nothing
End With
DoCmd.Close
End Sub

Private Sub btnCancel_Click()
' Confirm Cancellation Box
If MsgBox("Are you sure you want to quit?", vbYesNo, "Caution") = vbYes Then
DoCmd.Close
Else
DoCmd.CancelEvent
End If

End Sub

What I really want to do is once the update has occured is set a label I have as hidden, to show and to clear all the controls.

View Replies


ADVERTISEMENT

General :: Clear Sub Form At The Time Of Opening The Main Form?

Jul 24, 2013

I have a form, which is comprised of a sub form, and some of the text box controls sided with a button, and the event had been written to the button.

Now, to give a note on how had the sub form had been created is firstly taking a clone of the "Payments" table and using it as a datasheet, and then create a sub form in the form, it works fine

View 2 Replies View Related

Clear The Form

Jun 5, 2005

Thanks,
Now I can populate text fields by selecting any one of the combo box selection.

But I need to clear the form to insert next record. Currently I am inserting record by using Save_cmd button. I can insert second record but couldnot clear all the fields after inserting automatically. So I am doing clear all the fields manually or overwriting values.

If there is anyone pl. help me.

Thanks

View 2 Replies View Related

Clear Form

May 5, 2006

Hello,

I would like to put a button on a form I am making so that you can clear it without saving the data.

eg you open the form input a load of data, it is all wrong so you click clear form and start inputting data again

I have the button what do i need to do to get it to do this

Thanks

Chris

View 4 Replies View Related

Clear Form

Mar 7, 2006

I have a SQL Database that is housing my tables
I have an Access Front end that is Allowing users to view and edit the data residing on the SQL Database.

I have write/modify rights on the database and as such I wrote the code , OnLoad of Form, to Automatically set the Form to "Add Record", thus clearing all the TextBoxes and ComboBoxes. That works alright.

My problem is when a user without write/modify rights opens the Form I am getting an Error "Cannot go to specified Record". If I understand this right this is happening because they do not have suffeciant rights.

How Can I get a form to load and display all the textboxes and ComboBoxes BLANK....this only way I can think of is to set the form to Add Record.

ANY THOUGHTS

View 2 Replies View Related

Clear Form On Open

Aug 24, 2005

I've developed a form where users enter and select information that will be stored in another table. Currently when I open the form, the information I entered from the previous use is still in the text and combo boxes. Is there a way to clear this information when the form is opened (so all boxes are blank)?

Thanks!

View 5 Replies View Related

Clear All Textboxes On A Form

Sep 20, 2005

Is there a way to clear all the textboxes on my form without having to go through and assign "" to each text box value?


Thanks
Angelo

View 1 Replies View Related

Clear Data On Form

Dec 15, 2005

I searched the forum and couldn't find a thread to answer my question so here goes . . .

I have a form to lookup item number information. The user enters the item number and clicks on a "refresh" button to view information related to the item. Also the user can edit some of the fields using text boxes and a save command button.

I want to create a "clear" button which the user will click that will clear all of the data off the form before going to the next item. The form is bound to a table so I do not want to delete the data in the table, only clear the form. I have read that the form can be cleared by advancing to a new record. However, we do not want the user to create new records from this form. If you can tell me how to prevent the user from creating a new record, then the "advance to a new record" method could be a solution. I welcome any other ideas that you have to clear the form.

Thanks for you help,

Jeff

View 2 Replies View Related

Clear Unbound Form

Jan 29, 2006

Hello all,

Need your help again.

I have an unbound form with text boxes and 1 check box.

I created a module named Reset;

Private Sub Reset()


[Sales].Value = ""
[Corporate].Value = ""
[EndDate].Value = ""


End Sub

1) I linked this module to a macro so that on clicking a button, the macro runs the module and closes it, but it's not working.
in my macro, I have open module: Reset
I also have clode module= Object: Module, Name: Reset
But this is not working

2) Also, how do I clear the check box?

Thanks again for the help.

View 6 Replies View Related

Clear Button On A Form

Jun 12, 2006

I'm trying to create a search form with drop down boxes to select criteria.

I would like a "Clear Form" button that removes any data on the form to start a new search with. I have the following command in an "on click" event. But when I use this, it does clear the form. But from then on out, I get no results from my form. Even submitting the form with every entry blank, I get no results, when I know I have data in the form. I verified with my tables that the data in them didn't get deleted by using the code to clear the form.

Private Sub ClearForm_Click()

Me.[cmbNCTool].Value = ""
Me.[cmbNCDivision].Value = ""
Me.[cmbToolMaterial].Value = ""
Me.[cmbProfile].Value = ""
Me.[cmbToolType].Value = ""
Me.[cmbProfileType].Value = ""
Me.[cmbBoardThick].Value = ""
Me.[cmbMinorD].Value = ""
Me.[cmbShankD].Value = ""
Me.[cmbMaxCut].Value = ""
Me.[txtNotes].Value = ""
Me.[txtDesc].Value = ""
Me.[chkUsedArksCtyVeneer].Value = ""
Me.[chkUsedCorbinFoil].Value = ""
Me.[chkUsedFFallsVeneer].Value = ""
Me.[chkUsedFFallsFoil].Value = ""
Me.[chkUsedVbrgVeneer].Value = ""
Me.[chkUsedVbrgWood].Value = ""

End Sub

From what I know, this should only clear my form, not cause it to mess with results after it's used to clear the form once. I've even deleted this line of code from my database itself and I still get 0 responses back when I search.

Any ideas what I'm doing wrong, or is there a better way to clear a form with a button to click on?

Thanks for any help you can provide.

View 2 Replies View Related

How To Clear A Search Form

Oct 4, 2011

I have a search form where I enter a value and click on a command button. All records that correspond to that value are displayed (continuous form). Works fine.

However, when I exit the form and then go back in, the data from the previous search still populates the screen. The search value/field is blank, but all the previous records are still displayed. How can I clear those values everytime I enter the form (or exit the form) ?

View 2 Replies View Related

Clear A Form Field

May 30, 2012

have this code:

Private Sub
Job_Number_BeforeUpdate(Cancel As Integer)
If
IsNull(DLookup("[Job Number]", "Job", "[Job Number]= " & Me.[Job Number]
& " ")) Then
MsgBox "Job Number doesn't exist Enter a job
number that already exist."
Me.[Job Number].Undo
Cancel = True
End If
End Sub

It is not clearing the Job Number Field, and also it is not letting me to close the form without entering the Job number that already exist. If I try to close the form without entering the job number it gives me run time error " syntax error (missing operator) query expression '[Job Number] = '."

View 4 Replies View Related

Clear A Data Entry Form

Mar 2, 2005

My data entry form has a button that allows the record to be saved. However, after saving the record, the form doesn't allow a new record to be added. The new form just sits there with the previously entered information in it. How do I go to a new record?

View 4 Replies View Related

How To Clear The Content Of Controls In The Form

Jun 12, 2005

I designed a Data Entry interface. I wish the system can automatically clear all the values of controls in the form after users click the 'save' button.

Is there any good solution instead of manually setting each control's value to null?

I tried Undo method, but it didn't work on either control (textbox) or form itself.


Many Thanks

View 2 Replies View Related

How To Clear Info After Entering On Form

Apr 27, 2006

After informations is entered and a button is clicked to submit the information I can use the back/up arrows and page up to see what was entered even though the form is cleared. Is there something in the properties of the button that is clicked to submit that will make it impossible to see the prior users data.

It is personal information that people do not want others to see but is a public sign in computer.

Thanks

Tricia

View 3 Replies View Related

Forms :: Clear Form Upon Loading - Only Allow Labels

Dec 12, 2013

I'm having trouble getting my form to be "blank" except for the labels upon loading. I've tried putting in some code "on load" but it doesn't clear everything. I haven't had this trouble on some of my other db's, the only difference here is it's a switchboard. I don't know if that matters.

View 1 Replies View Related

Forms :: Clear Fields On Form Open

Jan 2, 2014

I have a timesheet form that pulls from a query that pulls from a table I want to clear my daily charges and reset back to the default value of 0 when my form opens ...

Saturday, Sunday, Monday , Tuesday , Wednesday, Thursday, Friday

View 1 Replies View Related

Clear All The Records In The Subform Of The Record In The Main Form

Jul 19, 2005

Hello,

I am trying to create a command button that clears all the records in the Sub form in the CURRENT RECORD OF THE MAIN FORM.
I know this sounds a little bit confusing, but I hope you understand!

The main form is: frmOrder2
The subform is: subfrmItemOrder

The fields in the subfrm that has to be cleared are:

Items (combobox)
UnitID (combobox)
K1 (txtbox)
K2 (txtbox)
K3 (txtbox)
CSB (txtbox)
DTSS (txtbox)
H (txtbox)
Remarks (txtbox)


The two forms are linked by the field OrderID.

Please help me!!
Thanks!
jenny

View 14 Replies View Related

Forms :: Can't Clear Filter Or Orderby Permanently On Form

May 14, 2013

I have a tabular form that is based on a select statement (Query) in the source property. It filters & sorts from this select statement. permanently

I have just added a
Me.Filter = "[Form1].[InDate] = #" & MyValue & "# "
Me.OrderBy = "Indate DESC"

This all works fine, filters & sorts on the existing results.However this new filter & sort seems to remain no matter what I do.I have used every variation one me.filter ="" with Me.FilterOn = True, False & every combination.

Me.Filter="" & Me.FilterOn = False does initially seem to clear the lsit to show all records but as soon as type anything that filters the Form on the original, existing underlying select statement the extra Filter Property & Sort properties are occupied with the last filter/sort.

I have manually deleted any remaining Filter Or Sort properties direct from design view, saved, compacted & saved again.Once I use the new me.filter it will always returned as soon an any filter on the form is applied.I definately am not setting it again anywhere. Is there something better than me.filter ="", seen clearallfilters mentioned but not sure if this would apply just to the current form but reluctant to use a blanket clear as I do have quite a lot of other things going on.

Not sure when but many months (If not years) ago my form source stopped being a query and started using the query (sql) direct from the source property.I have left it this way as not sure if any consequence of moving back but don't remember how or how it happened. What are the pros cons of using a separate query.

View 4 Replies View Related

Forms :: How To Clear Up A Specific Error On Search Form

Jan 7, 2015

I have a search form that's slightly modified search form modeled after the one available here on this site. It's a main form with a list box. I use the listbox to narrow down the results I want from the search function.

The search details are shown in a sub form that contains sub-sub forms

As seen in the code below, I am using the listbox to set a filter on the subform . Works famously until I search for something that does not exist in the database. I then receive runtime error 3075.

I believe it's related to the way I'm showing the details in the subform (by enabling a filter). If there is no record in the database that match the search criteria, I don't want any error messages or pop-ups and preferably would like the listbox to be blank.

Attached a screenshot of my form.
red = main form
green = subform
blue = sub-subforms
tan = obscuring the search results

Code:
Private Sub SearchFor_Change()
Dim vSearchString As String
vSearchString = SearchFor.Tex
SrchText.Value = vSearchString
Me.SearchResults.Requery

[Code] .....

View 2 Replies View Related

Forms :: Looping Through A Form To Clear Each Field For All Rows

Sep 4, 2014

How can I loop loop through a tabular form to clear each value in a field of all rows ? I tried the below code, but it did not work.

Loopcnt = DCount("*", "Budget")
For Loopcnt = 1 To Loopcnt
[Forms]![Budget Form].[Newbudgt] = Null
DoCmd.GoToRecord , , acNext
Next Loopcnt

View 8 Replies View Related

Forms :: Clear Fields In Form And From Table With A Button

Mar 10, 2015

I want to be able to clear all the contents in my fields (which are bound to my table) with a click of a button

View 1 Replies View Related

Clear Previous Data Entered In Parameter Form

Dec 16, 2013

I have a parameter form I used to enter data for a query. I want it to clear any previous data entered when it opens. I have tried the below without success. I also have the fields defaults set as "" and the form set at yes on data entry.

Private Sub Form_Open(Cancel As Integer)
Me.BldgCmb.Value = ""
Me.StateCmb.Value = ""
Me.CityCmb.Value = ""
Me.AddCmb.Value = ""
End Sub

View 3 Replies View Related

Forms :: Possible To Clear Filters Set On Subform Using Button On Main Form?

Jan 12, 2014

Is it possible to clear filters set on a subform using a button on the main form?

View 1 Replies View Related

How To Create Reset Button That Can Clear Text Box In Search Form

Jul 12, 2012

i already built reset button with this code but it is not working. i'm use this code;

Private Sub clearbtn_Click()
Me!qproject1 = " "
Me!qdoc1 = " "
Me!qvolume1 = " "
Me!qbox1 = " "
End Sub

it's any error in this code..??

View 2 Replies View Related

Clear A Combo Box

Jan 13, 2006

what's the best way of clearing the contents of a combo box? i don't want to change the row source, just make it blank as though a selection has not been made.

i have two unrelated combo boxes on a form; there will probably be more later. when i pick a value from one i want the other(s) to clear.

on the after update event of each combo i've tried clearing the contents of the other combo with these:

- me.othercombo = null
- me.othercombo = 0
- me.othercombo = ""
- me.othercombo.value = ...
- me.othercombo.undo
- etc.

'= null' clears the other combo.
'= 0' also clears the other combo.

but i think i'm missing something here. each combo also has a cmdbutton that will take the user to another form based on the selection made.

if i use '= 0', the other combo clears but its cmdbutton still works. even if the combo appears to be empty its associated cmdbutton still opens the next form (it should produce a msgbox asking the user to make a selection).

'= null' clears the combo and its cmdbutton produces the appropriate message to make a selection. so that's what i'm using right now. is this the best way? can something = null?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved