i have a form in access 2010 and i have a text box called USLINE and other one called USOFlag and i want the USLINE field to do like if it's is not null then it is a Y else N i try to do it in the LostFocus function but i cant get it to work.Here is the the code that i used:
Private Sub USLine9_LostFocus()
If IsNull(USLine9.Value) Then
USOFlag.Value = "Y"
Else
USOFlag.Value = "N"
End If
End Sub
Private Sub subCreateField(strTable As String, strField As String, strFieldType As String, strPath As String, lngVersion As Long)
Dim rstSerial As ADODB.Recordset Set rstSerial = New ADODB.Recordset rstSerial.Open "tblSerial", CurrentProject.connection, adOpenKeyset, adLockPessimistic rstSerial.MoveFirst If rstSerial!lngVersion < lngVersion Then
[code]....
Only the first field ("lngMethodID") gets created. The other two fields ("txtReferencePoint") and ("txtSpaceForPole") do not get created. If I exit the db before each sub call then all fields get added. Do I need to add some "refresh field" action or other action.
I want to enable a few fields when i click on the Add button on my form.I have change the onclick to Event Procedure to be able to add the following code
Code: Category_Desc.Enabled = True
My Category_Desc field get enable as expected but the Add button no long work
Code: Private Sub add_Click() Category_Desc.Enabled = True Me.Refresh End Sub
how to make this two fields in my form to say Y or N if the field is Not Null. Like if the field is not null = Y Else = N for the two fields. I have a picture to show what i'm talking about.
I am trying to open a form in design mode and add controls, this i have done. I am doing this all in a class, and am having trouble saving the modified form.
I have tried using the following, both produce errors
In one form, I have to click on button that opens the other form. Each form is bound to its table and those two tables are linked by Primary [RaDAR_Id] and Foreign [radar_id] fields. I would like the code to:
* open the other form * move to the first record that has [radar_id] = [RaDAR_Is] if exists
If there is no any record in the other form that contains [radar_id] = [RaDAR_Id] then I want to create such record. So I am using the code (below). The problem is that the other form is not being updated.
Code:
Private Sub cmd_edit_usage_Click() ' DoCmd.OpenForm "frm_edit_usage" Dim lngRadarId As Long Dim patientId As Long Dim rsUsage As DAO.Recordset Dim rsUsageWrite As DAO.Recordset
I tried Link model "bank_pay" with the main_form << to add details of information >> by "pay_num" in main_form and "num" in "bank_pay" by filter >>
Code: Private Sub pay_type_AfterUpdate() Select Case pay_type Case Is = "1" DoCmd.OpenForm "bank_pay", acNormal, "", """[forms]![main_many_1]![main_many_sub]![pay_num]="" & [num]", , acNormal
I have a form to add a record to a table. How can I give the user a way to close this form without saving the just created record.
I tried
If me.dirty then DoCmd.RunCommand acCmdDeleteRecord endif
This works, but gives a messagebox in return to confirm the command, and I don't want that. And I try to avoid sendkeys. I also don't want to change the options of access.
Hope someone can help on this. I have an Access database, nothing flash, that is now required to keep a spec sheets as an attachement. I am at a loss as to how to do this. Thanks
I have a form for entry and some fields are computed or result of a query from another table. I have a function that looks up a value from another table like so
************************************************** ******** Public Function GetTargetType() As Variant GetTargetType = DLookup("type", "tblFormulations", "[tblFormulations!formulation]=Forms![frmNmsConsumptionEntry]![formulation]") End Function ************************************************** ********
Which works fine when I test in the immediate window.Then I have this form event. This however does not insert this value when I am adding records using my continuous form.
************************************************** ******** Private Sub Form_BeforeInsert(Cancel As Integer) Me!target_group = GetTargetType() 'Forms!frmNmsConsumptionEntry!target_group = GetTargetType() '[tblNmsConsumption.target_group] = GetTargetType() End Sub ************************************************** ********
making sure I can insert this value once retrieved.
I am having troubles adding email addresses to my CC box in my email. I am able to get the emails to populate into the "To:" space. Now I know I have the DLookup accessing the same record, but how can I make it so the CC_List puts the emails into the CC of the email?
Code: Dim DailyReport As Integer Dim EmailRecipiantsList As String Dim RecipiantName As String Dim CC_List As String
I put the formula in the Text box field in the control source in the property's tool box and i don't know if it will save that calculation to the table. I was wondering if i can do VBA code to save the the calculation in the table.I have a field called CA Weigt and i put the formula in there as =[Weight] * 0.4536 and it works. How would i put it in a vba code.
I have a table with 100,000 plus unique rows and I want to add a column (call it 'ID') and place a value in each row starting with 000001 and adding one on to each row. What is the correct code to do this. I've tried with various combinations of For...next but can't get anything to work.
I have a form where there is just a combobox and a textbox, the user uses the combobox to select the record they want to change and then they enter a value in the textbox which needs to be added to a field in that record.
I get a runtime error "object required" what to do. The textbox is called DeliveryValue and the record I want to add it to is called StockNumber in a table called Products.
I have button the when pressed will insert a record (via an insert into query) to the frmMain and several records to the frmSub.The problem is when a new record is created in the main form the auto number primary key advances. This is fine however the linked Child field which is a foreign key of the main form is not added and the value is blank. I thought this would happen automatically and the Master field would force the child field to be update but this is not happening.Do I have to determine the max number used in the auto number then add 1 to it?
Code: "SELECT Bookings_Table.Booking_Time, Bookings_Table.Num_Slots, Bookings_Table.Booking_Date FROM Bookings_Table ORDER BY Bookings_Table.Booking_Time;"
But when i add the WHERE
Code: "SELECT Bookings_Table.Booking_Time, Bookings_Table.Num_Slots, Bookings_Table.Booking_Date FROM Bookings_Table WHERE (((Bookings_Table.Booking_Date)=[TB_CAL_DATE])) ORDER BY Bookings_Table.Booking_Time;"
it doesn't work [TB_CAL_DATE] is a textbox with a Date in it...
Who can tell me how to minimize Access window while it's form is on top of other open windows (e.g. other applications which are maximized like Excel). By using acCmdAppMinimize command, only the Access window is minimized and if other applications are maxmized, they will be on top. So is there any vba solution to do what I explained?
I am trying to program a button on my ms access form to open up an excel file.. So far the simplest code ive found online was from URL....
<code>
Private Sub Command57_Click() Dim xlTmp As Excel.Application Set xlTmp = New Excel.Application xlTmp.Workbooks.Open "C:Excel1.xls" xlTmp.Visible = True
[code]...
However the code doesn't work, any way to open a file from within access?
I have a form which on selecting a command button sends out an email to a manager to say a specification is ready to be reviewed (this contains a link to a sharepoint site where the spec resides). The "approval" details are stored in by DB also so I would like to have included in that email a link back to the access db and the particular record so the person receiving the email can easily approve, if that makes sense.
Here is my code for generating the email (at the point "To approve please click here" is where I would like my link to go):
[i][i] Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) strbody = "<font size=""3"" face=""Calibri"">" & _
In my database I've encountered a hitch - I've got one form set up to view one person at a time and I've got many records in this database - Is it possible to create a textbox and a button called search that will take me to the record containing this text?
i.e currently im on record abc i type into the text dfe and press search - it will take me to a record that contains that text?
I have recently started a project and become stuck already. I have a login form created that works (code below). What i want to do is allow access to the users of 1-7 in table (level of access) which will determine which page they view after logging in. IE if the have Access in table "Users" as "1" then when they log in the will see a form thats called L1. Same with 2,3,4,5,6 & 7.
Code: Private Sub LoginButton_Click() If IsNull(Me.LoginUsernameText) Then MsgBox "Please Enter Username", vbInformation, "Username Required"
my code does the following, user selects excel file, opens it, renames sheets, basically needs first sheet to be sheet1. rest don't matter Changes the formats in column a to number and 15dp, saves the file as .xls and then links the file to the database.
Code: Private Sub Command288_Click() Dim s As String Dim i As Long