I have a subform that I use to scan in products using a barcode reader, when the item scans it moves to the quantity (Qty) field where I have this code:
Code:
Private Sub Qty_GotFocus()
Qty.Value = 1
DoCmd.GoToRecord , , acNewRec
txtOrderNo.SetFocus
End Sub
I am simply trying to set the Qty value to 1 and move onto the next record ready to scan another product in.
I am currently stuck on set focus property. I have a main from with nested subform. I am trying to move the focus from last field of the subform to another field on the main form.
Now I have a field name [Securedesign] in frmOrderdetails and I want the tab order to navigate to field [CustomerID] in frmAddresses which is a subform to frmCustomers.
I am trying to write simple code that undoes entering a new record and moves the focus to a mandatory field. I wrote the code below; however, I get this run time error message each time I run it.
DB can't move the focus to the control PlotNum.
My code: Private Sub cmbHouseType_BeforeUpdate(Cancel As Integer) Forms![frmHouse]![qryHouse2]![PlotNum].SetFocus If Forms![frmHouse]![qryHouse2]![PlotNum].Text = "" Then Cancel = True Me.Undo MsgBox "Please enter the Plot Number first, then enter the House Type" End If End Sub
I have a tab control on my form. In the change event of the tab control I am trying to tell it to move to the first field on each page of the tab control whenever the page no. changes:
Private Sub TabScreenAssess_Change() 'when a new page gets the focus, set the focus to the first control on that page Dim PageNo As Integer
PageNo = Me!TabScreenAssess.Value Select Case PageNo Case "0": gynFemale.SetFocus Case "1": tbPriorHx.SetFocus Case "2": suSubUseAssess.SetFocus Case "3": mhaCognitiveFunct.SetFocus End Select
End Sub
This works when I am tabbing normally through the controls. But when I click back to the first tab, it says "Access can't move the focus to the control gynFemale" (gynFemale is the first control on the first tab.) It works for the other tabs. That is when I click on another tab, the focus goes to the first field on that tab. When I enter a value in the gynFemale field (it is a combobox, with options Yes or No), sometimes it appears to save the value, then I discover that it has been saved as record #0.
I don't like the look of Combo boxes on forms, especially on Continuous forms made to look like a spreadsheet. I think the arrow is distracting, and since you cannot change its color frequently looks bad. My plan was to use two controls - a text box, and a combo box. I would have the combo box hidden and the text box visible. When the user clicked on the text box, I would make the combo box visible, and hide the text box. Then, when the user left the field, I'd hide the combo box and reveal the text box.
The first procedure runs fine, and when I click on the text box it changes to a combo box. However, when the second procedure runs, I get error 2110, cannot move focus.
Any ideas why I get this error, or any ideas of a better way to accomplish this??
After I enter data into one field in a record I would like the form to save the record when I move to another field in the same record. It seems that the record is only saved when I exit it entirely. Is there a way to save a record when moving between fields in that record? Can this be done without using an Event Procedure for each field?
The school director is going to input a date (by default today) and a subform will display all of the students who started before that date and haven't been closed as of that date. Next to each name, there will be 4 radio buttons (present, absent, holiday, hospitalized), which by default will be set to present. The director will go down the line, only needing to click when a student isn't present. At the end, she'll push a save button and the new records will be added.
My proposed method:
1. When the textbox with date input is changed, the subform (or just form and I put the textbox in the header?) will populate itself with a query based on student names whose corresponding startdate and enddate work with the inputted date.
2. The subform will be in continuous view so that it kinda looks like a data sheet but it has radio buttons rather than just spreadsheet cells.
3. When the save button is pushed, some visual basic code in the background will look at record 1, grab the student name and selected radio button value, and add a new record to the AttendanceRecords table with the name, attendance type, and date. Then the code will move to the 2nd record, rinse and repeat until it goes through all of them.
Questions/problems:
1. At its core, is this the Access way of doing something like this? Is there a simpler, more efficient, or generally smarter way of doing attendance?
2. How is step 3 going to work? I can look up how to add new records to a table, but I'm not sure how to move around from record to record collecting corresponding data.
3. Since the AttendanceRecord table uses studentID and typeID rather than actual names and actual attendance types, what's the easiest way of adding the new records with that data efficiently? I'm thinking of making the RecordSource of the subform some sort of linked up set of tables such that if I'm looking at record 1 and the name in the textbox on the subform is "Bob" I can just reference studentID in the background without needing anything on the form at all with studentID?
I have a customer provide his or her SSN. If the SSN matches a record in a table the form opens specifically on that record (no problem). If the SSN doesn't match a record, the form adds a new record (again, no problem).
The issue I'm having is with the new record. The customer is able to scroll through other records (page up, page down), which is a no-no. I need the form to be locked on the new record. I've posted my code below.
Private Sub Command543_Click() On Error GoTo Err_Command543_Click Dim strCriteria As String Dim rst As DAO.Recordset Set rst = Me.RecordsetClone
I have a form with a subform which is sized to show several records at the same time. If Record A has the focus, and I click anywhere in Record B, then Record B gets the focus, as expected. ... Except if I click on an Image field in Record B, when the focus stays on Record A.
How I can force it to set the focus to the other record ? I don't think this can be done with Events handlers, as they need to have the focus set first.
I have two subforms on a "Page"/Tabs. Subform #1 is a continuous form which accepts data about dimensions of a pattern piece. The other subform needs to update its information display each time the last control of the first subform loses focus, because it tells me how much material is required for all pieces of this pattern that are entered.
My first feeble attempt at this was to add the following code to the "Lost Focus" event of the final control on the first subform: Form.Parent.Refresh
This succeeded in forcing the second subform to re-run its calculation.
However, after the recalculation took place, I wasn't able to move to the next record on the first subform. This subform is a continuous form, and I need to be able to add another row of data and then see the second subform change based on the additional information in the first subform.
I'm trying to get a DB to move records simultaneously using a command button. The records are setup with check boxes for example: one column has a check box for 1 Year Ratio the next column has a check box for 2 Year Ratio and the third column has a check box for 3 Year Ratio.
How can i move the information out from 3 Year Ratio into another table and then move 2 Year Ratio check into 3 Year Ratio check box and 1 Year Ratio check into 2 Year Ratio check box by using a command button.
Does anyone know how I can add a record to a subform that is in data sheet view with out giving the subform focus? I have tried the docmd.gotorecord but I keep getting an error that the form is not open. If i set focus to the subform and then use the docmd.gotorecord it works fine but I do not want to set focus to the sub form
ok ive read some responses to people having trouble or need to know how to move a record from one table to another... i have two tables. One with member and another with thier siblings. i have two forms. one with the member details which contain a command box to open the other form for their siblings. the siblings form is a tabular form so when i double clikc the siblings form i can all the children but when i open it from a specific member only their children are shown. each member has a memberID (primary key). but the siblings have the same ID as their father(member)
i have put a commmand box in the siblings form next to every sibling. what i want is that when i click this button the record moves to the members column.
i only know the very basics of VB...so a step by step explination would be helpful...
this is very specific and if more information is required please ask here or ask for my msn address.
I am trying to create a one(employee) to many ( assignment) database. In the form under Employee when I click next exmployee it goes to the next employee but shows the same assignment for the previous employee, how to do I get so they move together?
I have a sub form on a tabbed control. In the subform I have some calculated controls and I make them recalc when ever data in other fields change bu entering a recalc cmd in the update event of the required fields. That is all fine but the problem is that the forms focus moves to the first record and I need it to stay on the active record.
I have tried requery, recalc and refresh methods and they all do the same thing.
All I need to do is up date the calculated controls each time a field is updated and stay on the same form but it's eluding me.
Say i have two tables 1 = computers (it holds info about the computers) 2 = Repair (this table holds only the PCs that are under repair)
I want to be able to move one computer record to Repairs table as soon as i select that "this pc is under repair" on a form. So it does not show up on my report of computers in hand and shows up on computers in repair.
and when i get the pc back from repair, i want to be able to select "back in stock" and it'll move the record back to Computers tables & removes tht record from repairs table
is there a way i can do this automatically (without manually move a record)?
Any suggestions - web links or examples will be much appreciated.
Hi, Can anybody tell me how you automatically move to a new empty record when you open a Form? Till now, I always had the last record displayed. Thanx for your help
I have two table tbl_Employees and tbl_Femp my users use a form daily and now with help of baxter i'm finishing up on a new one. On my old form it was bounded and with a two step process check box and command button my users would send former employees to the former employees table, well i'm now using an unbound form and with the same script it will select all records and try to move them to the former employees table. here is my code:
Code:DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70Exit_saverecordcommand_Click: DoCmd.RunSQL "INSERT INTO tbl_Femp(FempID, FempLast, FempFirst, FempAdd, FempCity, FempZip, FempHomePhone, FempSSN, FempDOB, FempRank, FempRetCategory, FempComments, FempHireDate, FempRetDate) Select EmpID, EmpLast, EmpFirst, EmpAdd, EmpCity, EmpZip, EmpHomePhone, EmpSSN, EmpDOB, Rank, RetCategory, EmpHireDate, RetDate, RetComments from tbl_Employees where Retiredarchive =Yes"DoCmd.RunSQL "DELETE * from tbl_Employees where RetiredArchive = Yes" Can some1 please tell me where i'm going wrong? thanks in advance...
I have a form we use for data entry, and not all the fields willhave data in them. When we click the new record button the cursor stays in the field where it was for the last record. We would like the cursor to move to the first field on the form everytime a new record is started. Can anyone help me out here??
I have a database where on the bottom I have kept the record navigation buttons. When I move to the next record is fine, but when it reaches the end and I press once more, it will create a new one. How can I avoid this?
I made a button special for that purpose to creat new record). I guess the best option will be not to show the record navigation and create buttons to go back and forward and avoid that the next press of the button will create new record.
Then I have records in each table with fields ,Name and Status(Done and Done_s)
I want records having "Done_s" to be moved to b whenever the change has occurred. Is this possible?(I have tried somethings with Macros but didn't work)...