I have an unbound form
In the form there are 40 textboxes.
There names are like this:
A1
A2
A3
A4…
When I open the form I wrote code like this:
For I = 1 to 40
If …. Then
*****************
I WANT TO WRITE IN THE TEXTBOX
BUT I DON’T KNOW WHAT IS THE “I” VALUE
IF I WROTE “A” & i
ITS DOSENT WORK
WHAT CAN I DO?
******************
End if
I have a onclick tied to a label (for decoration purposes) that when clicked it launches VBA that essentially updates a form. All that part works except it will not recognize any changed value of the field I was last in?
Just to try to explain best as I can what happens.
- Form gets opened - I change field (quantity field) - I click the Label - It reverts to pre-existing value.
if I click off of the text field first then do the onclick - it recognizes just fine.
I have an unbound form with start date and end date text boxes. The code behind the form allows a combination of dates to produce a report, but only one named report. I would like, with your help, to give the user a choice of reports to preview and/or print. Thank you in advance for divulging your knowledge.
I will do my best to try and explain what I am trying to accomplish.
I have a form that has two fields [NumbX] and [NumbY] They way they display on my form is [Numbx] of [NumbY]. These two field show which transaction of the total number of transactions. So basically if someone comes in to do a transaction, they could be doing just one ([NumbX =1] and [NumbY] =1). If they are doing 3 transactions the fields would be [NumbX]=1 and [NumbY]=3. As they complete subsequent transactions [NumbX] increased incrementally, until X =Y.
Every transaction ends with a Print Form opening and the user confirming the printing of the transaction. In the print form I have coded it to clear the main form once X= Y otherwise retain some of the information input in some of the fields for the subsequent transactions. Right now, I have it set up that the user inputs [NumbX] manually. What I would like to do is have that automatically increase by 1 when the print form closes. This should continue until [NumbX]=[NumbY].
The fields are unbound and used solely for driving other activity (opening other forms) so autonumber is not an option.
I am trying to troubleshoot a form and I am at wits end with it. :eek: I hope someone can help me.
There is a form whose record source is based on a query. When it opens it loads all the records. At the bottom of the form, there is an unbound text box that is used as a filter. The person is suppose to be able to type something in there and then once the cmd button is pressed it filters bases on the value of that text box. That appears to work fine.
The problem is, when the form loads, the unbound text box is locked. It does not allow anyone to type in it.
I checked form properties and also the text box property and it is not locked. I have added code on the getFocus, OnLoad, OnUpdate..ect, to make the properties of that text box unlock it self. I have had no success with that.
I did notice that after the form loads and I hit Design view and then change back to Form view, the text box is unlocked and allows typing. :confused:
Why then does it allow editing, but not on initial load. Any help would be wonderful. If further explanation is necessary, please ask.
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
Hi I am using an unbound form for data entry to prevent errors getting into the table i.e. if with a form bound to the table, the user exits the form having only entered one field, a record is created with that field completed only. I use code to write the record to the table but unless the form is closed and reopened any subsequent records are not added to the table. I am probably going about this in completely the wrong way and any advice would be appreciated. Below is the code that I use.
Keith
Private Sub cmdSave_Click() On Error GoTo Err_cmdSave_Click
'Validate Data before Save If IsNull(Me.txtRegNo) Or Me.txtRegNo = "" Then Call MsgBox("Registration Number is Required", vbInformation, "SAVE ERROR")
I've been looking at Sbaxters example unbound form. I want the form to be unbound, but I also need the form to show the autonumber straight away when they create a new record, but the data they enter into the text boxes only gets written to the DB tables when they hit the Save button. Is this possible?
Also, on my forms I always have a record count (on the On_Current event) of the form. When they use the next button this changes to show 1 of 100 for example. If the form is unbound how do I get this to display how many records are in the DB or how many records have been found during a search.
hi guys, i have a continuous form with a check box and a button on each record's row.
now if i dont bind the check box to a control source when you tick it, it gets ticked for each record, i am using the tick box to pass a state to the button ( uses an if statement ) so that it will done different things if it is ticked when the button is pressed.
can anyone help me to get this to work without having to bind the check box to a control source?
Is anyone there who can show me a db sample of unbound data entry form. I want to control the builtin auto save of Access, because sometimes I don't want to save the data of my form..
Hello, here is my problem: I have a form to add records to my table. I cant bound it, because the controls are tick boxes, and they need to be "converted" into text to add them to my table. I have a save button, so I can execute an insert statement with all the data I want to add to the table. The problem is, once I have saved the record, I want to clear the form to add a new record, and I cannot use a docmd.gotorecord acnext as it is an unbound form. Is there any way to clean a form without going control by control? Thanks! Cristina
I would like to have a form with a combo box open and then when a company is clicked on i would like for my report to open showng all those listings. I have the query and the report and the form but how do i get them to all work together they are not playing nice.
Is it possible to have an unbound image control on a tabular form displaying a different image for each record ?
Actually i have tried putting some code on the onCurrent event, but it is displaying the same image in all records, depending on which record is current.
This is the code which i tried using:
Private Sub Form_Current() On Error GoTo Err_Form_Current If Not IsNull(Me.txtCountry) And Not IsNull(Me.txtCatalogueNumber) Then Me.Stamp.Picture = Environ("userprofile") & "My DocumentsDatabasesPhilatelyStamps" & Me.txtCountry & Me.txtCatalogueNumber & ".jpg" ElseIf IsNull(Me.txtCountry) Or IsNull(Me.txtCatalogueNumber) Then Me.Stamp.Picture = Environ("userprofile") & "My DocumentsDatabasesPhilatelyStampsNotAvailable. jpg" End If Exit_Err_Form_Current: Exit Sub Err_Form_Current: If Err.Number = 2220 Then Me.Stamp.Picture = Environ("userprofile") & "My DocumentsDatabasesPhilatelyStampsNotAvailable. jpg" Else MsgBox Err.Description, vbExclamation, "Error #" & Err.Number End If End Sub
Actually, the above code works fine for Single Form, but not on tabular form.
ok, I've copied/changed some code and get "data type mismatch in criteria expression". Obviously, I don't quite understand what I'm doing. Access 2003.
Code: Private Sub Command13_Click()On Error GoTo Err_Command13_Click Dim DAOdb As DAO.DatabaseDim DAOrs As DAO.RecordsetDim s As String Set DAOdb = CurrentDb()s = "Select * from tblECOs where tblECOs.ECO = '" & ECO & "';"Set DAOrs = DAOdb.OpenRecordset(s)With DAOrs.Edit.Fields("status") = "CANCELED".Fields("date") = Me.txtDate.UpdateEnd WithDAOrs.CloseDAOdb.Close Exit_Command13_Click:Exit SubErr_Command13_Click:MsgBox Err.DescriptionResume Exit_Command13_Click End Sub
I have a form with a bound combo box. There is an unbound text box for display purposes only that is supposed to reflect the third column of the combo box for the current record.
I set it's default value at [cmbPartyType].[Column](2) .
It works for the first record. but when I scroll through the records, the box keeps the value that was appropriate for the first record. how can I get it to look at that combo box on every form? Even if I am not update records, just looking at them?
I have a form that has unbound text box controls. The user enters numeric data in each of these text box controls. I want to be able to store the values that the user enters for future use. I am using the following code which was provided on Richard Killey’s web site. The problem is that the values that the code stores in the unbound text boxes is populated back as text values rather than numeric values. Here is the code that saves the values. Code:Private Sub cmdSave_Click() '--- only process Save if there is data in scheme name If IsNull(txtScheme) Then MsgBox "Please Enter A Scheme Name" txtScheme.SetFocus Exit Sub End If Dim rst As Recordset '--- use the primary key (which is always an autonumber field) to find the record '--- if it is a new record, this will find no records, as txtID will be 0 Set rst = CurrentDb.OpenRecordset("select * from tblschemes where ID=" & txtID) If chkNew = True Then '--- do we add a new record and save an existing one rst.AddNew Else rst.Edit End If '--- transfer data from text boxes to table fields rst!MVol = txtMVol rst!TVol = txtTVol rst!WVol = txtWVol rst!ThVol = txtThVol rst!FVol = txtFVol rst!SVol = txtSVol rst!SuVol = txtSuVol rst!Scheme = txtScheme rst.Update '--- save the record rst.Close '--- close the recordset Set rst = Nothing '--- reclaim the memory the recordset was using chkNew = False '--- reset the new flag '--- enable the list box and the Add New button and the Close button '--- must be done before moving focus to the list box lstData.Enabled = True cmdAddNew.Enabled = True '--- make sure the newest data is in the list box lstData.Requery '--- set the focus to the list box lstData.SetFocus lstData = lstData.ItemData(0) Call lstData_AfterUpdate '--- disable the text boxes and the Save button, and make Edit button enabled txtMVol.Enabled = False txtTVol.Enabled = False txtWVol.Enabled = False txtThVol.Enabled = False txtFVol.Enabled = False txtSVol.Enabled = False txtSuVol.Enabled = False txtScheme.Enabled = False cmdSave.Enabled = False cmdEdit.Enabled = True End Sub And here is the code that populates the values back into the unbound text boxes after an update. Code:Private Sub lstData_AfterUpdate() '--- whenever a new item is chosen in the list box, display the data in text boxes txtScheme = lstData.Column(1) txtMVol = lstData.Column(2) txtTVol = lstData.Column(3) txtWVol = lstData.Column(4) txtThVol = lstData.Column(5) txtFVol = lstData.Column(6) txtSVol = lstData.Column(7) txtSuVol = lstData.Column(8) txtID = lstData.Column(0) '--- primary key is in the first column (always) End Sub How do I change the code so it stores the values as numeric rather than text ? Thank you for any help that can be offered.
I have a unbound text box in the form header and have a command button in form I am wanting to put the unbound textbox value into a bound textbox on form.
I'm trying to populate a form textbox which is unbound.
I have table with a list of peoples login names and a query filtering these names once a user logs in. If the GetUserName() matches one of the names in the table then user is authorised. this part seems to be working fine. User not on the GetUserName() list the filter says blank ie Not Authorized.
How to take this confirmed user name and place it into a textbox on a form?
Table name: [tblUserNames] with [IngEmpID] & [UserName]
Query Name: [qryUserNames] with a Criteria GetUserName()
I have a form that reads records from a query.. It loads the first record into the form, without issue.
Code: Sub FormLoaded() Dim r As DAO.Recordset Set r = CurrentDb.OpenRecordset("Results") ' Query we want Forms("frmmainnew").lbladdUser1bad.Visible = False
[Code] ....
Now I have have 2 buttons at the bottom of the form, one for next record and another for previous record...
Code for next record
Sub NextRecordbtn() Dim r As DAO.Recordset Set r = CurrentDb.OpenRecordset("Results") ' Query we want r.MoveNext If r.EOF = True Then
[Code] ....
I know that I have 3 records that result in the query named "Results", the next record button will bring the form from record 1, to record 2... however it will not move from the 2nd to the 3rd record...
I have set up a query to give me details of employees names, the business they work for and where they work.
If I run it without criteria I get all of my records, as you would expect.
However, I want to be able to select parameters from combo boxes and then run a specific report of employees by location. I did have this working by accident a while ago but have changed quite a lot since then.
I have set up an unbound form with three combo boxes - Business, Business Unit and Location. Then a button for preview and print report linking to my report template.
I have refernced the controls in the relevant columns of my query as: [Forms]![FormName]![Control].
When I run the query I get nothing back and I don't understand why.
I get the feeling I'm really missing something glaringly obvious here but I'm struggling.....
I have a combo box on my switchboard that looks up field txtOfficer in a query and then want it to open up a new form containing only those records relating to the officer name selectedtxtOfficer
The rowsource for the combo is:
SELECT DISTINCTROW [qryMain].[txtName] FROM [qryMain];
When I select a name from the combo I get a parameter box and have to type in the name to open up the filtered records form. How can I get rid of it so the selection is one seamless process? :confused: