I have VBA code that switches a form to a report that works with buttons but refuses to work when first loading up the database.
Ideally I want the database to open , with a control form set as the default load form, and then this immediately loads a report, which it does, but it doesn't ever switch to it?
I use as standard: DoCmd.OpenReport "rpt_here", acViewPreview, , , acWindowNormal
I have a field in a table where it is a lookup is a combo box. So this makes the data type of the field a number when in reality it is a text. When I have this field show in a list box it shows the number instead of the text.
I want to return a value from a separate query and have that show up in a field on my main form. The field name from the query is "Six Month Date" and the query name is "DT6Monthqry". I want to return the value displayed in the"Six Month Date" from the query, matching the CustomerID in the query result to the CustomerID that is being displayed on the main form. The CustomerID is a text field.This is the code I placed in the Control Source property for the field I want to be displayed on the main form:
I have a suppliers table and a products table. Two forms, Stock form with combobox to list Suppliers and a sub form with combobox that lists Products.I want to select a supplier from the Stock form and then the combobox in the subform to only list products directly sold by the Supplier.Have dabbled in SQL as follows:
SELECT Products.ProductID, Products.ProductName FROM Suppliers INNER JOIN Products ON Suppliers.SupplierID = Products.SupplierID WHERE ((Stocksubform.SupplierID=Stock.SupplierID)) ORDER BY Products.ProductName;
I created a navigation form on which I put a form call [frmAnimal Setup].
I then placed one combo box on the Navigation frm Header. I have bound it to its source and it actually queries the tbl and show the right info. However when I select one, it will not let me.
In addition, [frmanimal setup] will not allow me to select a breed although it does query the tbl and shows the right information.
How do i set a form to start on a new record when it loads? I have tried the data tab in properties but there isn’t anything there what do I do? Can I use some VBA code?
hello all, i have a form which I have set so that it opens a blank record once opened. After it has been opened I want a msgbox to appear. my code so far is: --------------------------------------- Private Sub Form_Load() DoCmd.GoToRecord , , acNewRec
Select Case MsgBox("Please select the Registration Number from the drop down menu or type it in", vbOKOnly, "Select Registration Number")
End Select End Sub -------------------------------------------
but the problem is that the msgbox appears before the form is opened. any ideas how to fix this would be grately appreciated. thank you
I have generated a combobox search for my form and I am able to select names that are different and the information is generated on the form. However, when I have two names that have the same last name my selection will default to the primary key instead of the name I selected in the combobox. Here is the code I am using:
Here is my RowSource: SELECT [Client Info].CltLname, [Client Info].CltFname, [Client Info].DOB, [Client Info].[Last 4 SSN] FROM [Client Info] ORDER BY [Client Info].CltLname, [Client Info].CltFname;
I have run a query to sort by CltLname and then by CltFname
Private Sub cboClientSearch_AfterUpdate() 'Moves to Customer Name text box and 'finds the record of whatever name is selected in the combo box DoCmd.ShowAllRecords Me!CltLname.SetFocus DoCmd.FindRecord Me!cboClientSearch 'Set value of combo box equal to an empty string Me!cboClientSearch.Value = "" End Sub
how to get the combobox to display what I have selected instead of defaulting to the earliest primary key associated with the same last name?
The code I'm using should work, it doesn't, though similar code from a Text control does work. Basically, if someone selects "Other" I want [Chg_Type_Oth] to be Enabled and SetFocus.
The cmb_Chg_Type combo box, that stores into Chg_Type, has the following entries to select:
"Equipment New";"Equipment Modified";"Operator New";"Operator Move";"New Process / TTD";"Other";1
-I added "1" to see if that was the issue, but alas that didn't work either
Here is the code that isn't working (using two variations, just in case I was hitting an Access Wall, and the Select Case is purposely remarked out):
Private Sub Cmb_Chg_Type_AfterUpdate() ' Select Case Me.cmb_Chg_Type ' Case "Other" ' Me.Chg_Type_Oth.Enabled = True ' Me.Chg_Type_Oth.SetFocus
[Code] ....
Though this works fine from an ordinary text box:
Private Sub Chg_Name_AfterUpdate() If Me.ChangeName = "Other" Then Me.Chg_Type_Oth.Enabled = True Me.Chg_Type_Oth.SetFocus End If End Sub
Anyway, I'm expecting something obvious will show up...
I've got a parent/sub-form set up, both of which derive their data from linked tables connecting to a central database. As a result I've had to add coding to the NewRecord events to fetch the next primary keys from the database.
Unfortunately I'm finding that one loading the new record, the child form seems to be loading before the parent, ie the child form_Current event occurs before the parent form_Current event. Is this how it should be? It seems intuitive that the parent should load first.
I'm sure I can develop some cunning logic to get around this problem but I'm sure there must be a better way. Has anyone any experience of this parent/child set-up with linked, central database tables?
I have a form that displays data based on a simple query. The query asks for a PO number (from the query) and then displays the data. I wish to open a web page after the PO number is put in. What is the vb code to do so and is it on the onLoad or onOpen portion of the form?
Also, the web address needs that PO number. So, the web address would be: http://www.mydomain.com?PO=PONumber where PONumber is what was entered into the text box that was prompted by the query. Any ideas on where to start on this one? Thanks!
I have been trying to make forms open scrolled to the top and have had very little success.
I found a function on the following site http://www.lebans.com/SelectRow.htm that works great as demonstrated and when I attach the following code to a text box the form scrolls to the top.
Private Sub Text98_Click() Dim lngret As Long lngret = fSetScrollBarPos(Me, 1) DoEvents End Sub
What I am trying to do is have the form scroll when it opens but by attaching the above code to the form's on_open event there is no effect.
I have parent form and child subform. one field in the parentform is calculated on sum of records on the childsubform when the parent form loads initially the value in the calculatedfield is 0 then it shows the correct value when the childsubform value is populated i have another-field i want to change the property of the onotherfield.backcolor= RGB(0,0,255) when calculatedfield.value<0 but its taking the initial value(0) not the calculated onewhich event shall i invoke on the form so that it waits the subform to complete then fires ... i tried current, load, activate events .. with no success.
I'm having abit of bother with a database I'm fooling around with.
Basically it has 4 main tables at the moment.
Personal Details Participant ID (Autonumber) etc
Training Details Participant ID (Number) Attendance ID (Text Field) Auto generated by expression =[Participant ID]&[Course Code]&[Level Code] etc
Attendance Records Attendance ID (Text Field) Review ID (Text Field) Auto generated by expression =[Attendance ID]&[Month]
Reviews Review ID (Text Field) etc
These tables are linked by standard one to many relationships. (http://www.flamingbird.com/relationship.png)
Everything worked fine until I decided to Auto Generate the Attendance IDs and Review IDs to save confusion amongst those administering it.
Now it reports when I try to add a new record to the tables with the Auto generated IDs that:-
Index or Primary Key cannot contain a null value.
It appears the auto generated ID's are being mistaken for NULL values!
Anyone any ideas as to why this is happening? This is really my first time trying anything this complex, every other database I've done relied heavily on the data inputer.
Oh and its Office 2003, but the database is in 2000 format cos not all the office has office 2003 just the training end.
I did a search in the form forum and couldn't find anything close that had a response.
I have a parent form and a sub form.
I have the parent set up to make the enable property false for the command buttons that aren't appropriate when you first open the form: Like Save and Undo.
I want to do the same for the child form, which has different data linked to the parent form.
The parent form always grays out the inappropriate boxes.
The subform will gray them out only if I open it as a stand-alone form. When I put the code in the Open, or Load or Gotfocus events I get an error message that it cannot locate the subform.
I have a couple of command buttons on a form. They have embedded bitmaps as pictures with a caption below. For some reason when the forms loads (and also in design view), there is a narrow white outline / border around them. As if the button is drawn on a slightly larger white square?This border disappears as soon as I hover over the button (in form view) or click on the button (in design view).
I have on very large form in my db that takes several seconds to load. I want to optimize things, so I am trying to have it load hidden in the background when the db first starts up, this way it can be immediately called on when it is needed later. Please read further :
I want to have a splash screen that loads as well. I have set the splash screen to the default form when the database opens. However, I am not quite sure how to get the other form to load in the background as hidden, AFTER the splash screen opens and appears. I tried calling it with the oncurrent event of the splash screen, but then splash screen wont appear until after the other (hidden) form has finished loading. I have tried different orders of events, but am having no luck getting the desired results.
Summary: I want the splash screen to show first, then the big form to open (hidden) in the background. The user can click on a continue button on the splash screen and then the main switchboard will open.
I have an ordinary table with 20 fields and in the design view the primary field is shown as an auto-number, but it doesn't appear in the datasheet view.