![]() |
|
|
#1
|
||||
|
||||
|
If you are looking for a specific piece of code it can be difficult to find an example by searching through the posts. So use this thread to ask for examples.
KISS - Keep It Short & Simple Check to see if is has not been requested and provided already |
|
#2
|
|||
|
|||
|
XP, Access 2000. I want to provide user with a button on a form which will replace all FLAG fields containing an "L" with an "R". Am almost there with macros, but can't make the macro quit neatly. Thanks.
|
|
#3
|
||||
|
||||
|
Table and field names are for brevity only. Use your real names.
Code:
Private Sub CommandButton_Click() 'Surpress Access action alerts DoCmd.SetWarnings False 'Run update sql DoCmd.RunSQL "Update [YourTableName] Set [YourField]= 'L' Where [YourField]='R'" 'Switch alerts back on DoCmd.SetWarnings True End Sub David |
|
#4
|
|||
|
|||
|
Thanks for your prompt response. Works just like I wanted.
|
|
#5
|
|||
|
|||
|
I am trying to use the following in the autoexec macro to hide the ribbon and QAT, but it does not work for me. I do not know the full way that it has to be put into a module as code. I am new to VBA.
Public Function DisableRibbon() DoCmd.ShowToolbar "Ribbon", acToolbarNo End Function Access 2007, Windows xp |
|
#6
|
|||
|
|||
|
I'm receiving data in a csv format from online request forms that are built on our website. Most fields break out easily into their respective columns, however one field is basically all the collective MetaData from each of the custom qualifier questions we ask in our form. An example of how the metadata looks is below:
<grp8_dealer><![CDATA[86]]></grp8_dealer><grp8_how_hear><![CDATA[Search Engine,Previous Experience,Referral]]></grp8_how_hear><grp8_how_hear_other><![CDATA[]]></grp8_how_hear_other><grp8_also_interested><![CDATA[PondAndLakeManagementCD,SpecificationManual,Specif icationManualCD,Site Evaluation]]></grp8_also_interested><grp8_additional_comments><![CDATA[]]></grp8_additional_comments><grp8_interested_in><![CDATA[AeratingFountains,LargeAeratingFountains,GiantFoun tains,SmallPondSystems,FountainGloLighting,LakeDye]]></grp8_interested_in><grp8_pondlake_experiences><![CDATA[FoulOdors,AlgaeBlooms,FishKills]]></grp8_pondlake_experiences><grp8_pondlake_experienc es_other><![CDATA[]]></grp8_pondlake_experiences_other><grp8_pond_used_fo r><![CDATA[Recreation,Stormwater]]></grp8_pond_used_for><grp8_pond_used_for_other><![CDATA[]]></grp8_pond_used_for_other><grp8_purchase_time><![CDATA[]]></grp8_purchase_time><grp8_market_associated_with><![CDATA[Residential,Commercial,Municipal]]></grp8_market_associated_with><grp8_market_associate d_with_other><![CDATA[]]></grp8_market_associated_with_other> I need to know how I can get each of the <grp8_*> values to be established as the column headings and the <!CDATA[*]> values associated with them to appear as the field values below. (if nothing is answered/selected there is still a <grp8_*> heading, just no <!CDATA[*]> value assisnged to it.) Ideally once the values in the MetaData column are broken out into their own columns, I need them to remain associated to their respective customer record (ie name, company, etc.) Any suggestions, guidance and/or assistance is GREATLY appreciated. Thanks! |
|
#7
|
|||
|
|||
|
I am looking for a way to allow a user to define their own custom reports on the fly from the existing database tables and queries.
|
|
#8
|
||||
|
||||
|
Hi all,
Sorry, my English isnt good, it makes me confused .How can I get all IP address on LAN using VBA? Thank you! |
|
#9
|
||||
|
||||
|
Option Explicit
Private Const IP_SUCCESS As Long = 0 Private Const WS_VERSION_REQD As Long = &H101 Private Const MIN_SOCKETS_REQD As Long = 1 Private Const SOCKET_ERROR As Long = -1 Private Const INADDR_NONE As Long = &HFFFFFFFF Private Const MAX_WSADescription As Long = 256 Private Const MAX_WSASYSStatus As Long = 128 Private Type WSADATA wVersion As Integer wHighVersion As Integer szDescription(0 To MAX_WSADescription) As Byte szSystemStatus(0 To MAX_WSASYSStatus) As Byte wMaxSockets As Long wMaxUDPDG As Long dwVendorInfo As Long End Type Private Declare Function gethostbyname Lib "WSOCK32.DLL" (ByVal hostname As String) As Long Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (xDest As Any, xSource As Any, ByVal nbytes As Long) Private Declare Function WSAStartup Lib "WSOCK32.DLL" (ByVal wVersionRequired As Long, lpWSADATA As WSADATA) As Long Private Declare Function WSACleanup Lib "WSOCK32.DLL" () As Long Private Declare Function inet_addr Lib "WSOCK32.DLL" (ByVal s As String) As Long Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal Buffer As String, Size As Long) As Long Sub TestingFunction() If SocketsInitialize() Then MsgBox "IP address of " & GetPcName & " is: " & GetIPFromHostName(GetPcName) End If SocketsCleanup End Sub Public Function GetIPFromHostName(ByVal sHostName As String) As String 'converts a host name to an IP address. Dim nbytes As Long Dim ptrHosent As Long 'address of hostent structure Dim ptrName As Long 'address of name pointer Dim ptrAddress As Long 'address of address pointer Dim ptrIPAddress As Long Dim sAddress As String sAddress = Space$(4) ptrHosent = gethostbyname(sHostName & vbNullChar) If ptrHosent <> 0 Then ptrName = ptrHosent ptrAddress = ptrHosent + 12 'get the IP address CopyMemory ptrName, ByVal ptrName, 4 CopyMemory ptrAddress, ByVal ptrAddress, 4 CopyMemory ptrIPAddress, ByVal ptrAddress, 4 CopyMemory ByVal sAddress, ByVal ptrIPAddress, 4 GetIPFromHostName = IPToText(sAddress) End If End Function Private Function IPToText(ByVal IPAddress As String) As String IPToText = CStr(Asc(IPAddress)) & "." & _ CStr(Asc(Mid$(IPAddress, 2, 1))) & "." & _ CStr(Asc(Mid$(IPAddress, 3, 1))) & "." & _ CStr(Asc(Mid$(IPAddress, 4, 1))) End Function Public Sub SocketsCleanup() If WSACleanup() <> 0 Then MsgBox "Windows Sockets error occurred in Cleanup.", vbExclamation End If End Sub Public Function SocketsInitialize() As Boolean Dim WSAD As WSADATA SocketsInitialize = WSAStartup(WS_VERSION_REQD, WSAD) = IP_SUCCESS End Function Public Function GetPcName() As String Dim strBuf As String * 16, strPcName As String, lngPc As Long lngPc = GetComputerName(strBuf, Len(strBuf)) If lngPc <> 0 Then strPcName = Left(strBuf, InStr(strBuf, vbNullChar) - 1) GetPcName = strPcName Else GetPcName = vbNullString End If End Function I forund this on the web see if it serves your purpose. |
|
#10
|
|||
|
|||
|
I am trying to build an expression that calculates the total hours worked that may or may not cross over midnight. I am using 2007 with colums named Start Date, End Date, Start Time, End Time, and Totoal Hours. I need this to work in both forms and reports. Can someone please help me?
|
|
#11
|
|||
|
|||
|
Hi.. i need to make my access application can't close by using end process/task in windows task manager. But i don't want to disable the windows task manager. I guess i must set the process priority of my application to high level or real time. Any one can know how to do that using vba code?
|
|
#12
|
|||
|
|||
|
Could someone post the best way to open 2 tables in a module? I have one table that has two fields Project and Part (I am ignoring the AutoKey). Ex:
Project 1, Part A Project 1, Part B Project 2, Part A Project 2, Part C Project 2, Part D I want the to write in VBA a way to combine the above and create a new record for each Project. Ex. Project 1, Part A Part B Project 2, Part A, Part C, Part D I feel comfortable writing the VBA code in getting the resultant, but I am having trouble getting started with opening the tables required. I started with: Dim dbs As Database Dim dbsNEW As Database Dim rst As Recordset Dim rstNEW As Recordset Set dbs = CurrentDb() Set dbsNEW = EndDB() Set rst = dbs.OpenRecordset(StrSQL, dbDynaset) Set rstNEW = dbs.OpenRecordset(StrSQL, dbDynaset) I error out at the line in Bold. If someone could point me in the right direction, I would appreciate it. |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Type Mismatch - HELP!
|
jgelpi | Programming | 3 | 07-17-2009 01:53 PM |
| Same code, different form, one good, other type mismatch | Helen | Programming | 4 | 05-16-2009 07:17 PM |
| Type into field that is a Combo Box on the fly | Najani12 | Access | 0 | 02-27-2009 10:27 AM |
| fields of type text | ashiers | Forms | 0 | 11-28-2008 07:52 AM |
| Number data type | BernardKane | Access | 1 | 11-11-2006 05:19 PM |