Re: I wany to record an IP address in access

Tech-Archive recommends: Fix windows errors by optimizing your registry



Use 4 fields of type Byte.
You can print them with dots between the numbers if you wish.

To get the next available number in your form, use the AfterUpdate event
procedure of btye 3 to lookup the maximum number used so far for byte 4.
Example:

Private Sub Byte3_AfterUpdate()
Dim strWhere As String
Dim varResult As Variant

If Not (IsNull(Me.Byte1) Or IsNull(Me.Byte2) Or IsNull(Me.Byte3)) Then
varResult = DMax("Byte4", "Table1", strWhere)
If IsNull(varResult) Then
Me.Byte4 = 0
ElseIf varResult < 255 Then
Me.Byte4 = varResult + 1
End If
End If
End Sub


--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Cider Baby" <Cider Baby@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A02FD462-4D64-4704-AF4D-7240EF96E212@xxxxxxxxxxxxxxxx
>I want to be able to record a different range of IP addresses for different
> types of devices. I want the database to give me the next available IP
> address.


.



Relevant Pages

  • Re: Find only specific part of a record
    ... Private Sub Text0_AfterUpdate ... Dim strWhere As String ... rather than allenbrowne at mvps dot org. ... > containing "chris" as part of the text. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Command Buttons
    ... > Private Sub cmdFilter_Click ... > Dim strWhere As String ... rather than allenbrowne at mvps dot org. ... >>I am not very familiar with filtering options. ...
    (microsoft.public.access.forms)
  • Re: Command button issues
    ... It assumes there are 2 unbound text boxes where the user ... > Private Sub cmdFindPart_Click ... > Dim strWhere As String ... rather than allenbrowne at mvps dot org. ...
    (microsoft.public.access.forms)
  • Re: Code to determine if record exists in file
    ... Use DLookup to see if the value is in the table. ... Private Sub Date1_AfterUpdate ... Dim strWhere As String ... rather than allenbrowne at mvps dot org. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Populating tables with symbols
    ... Private Sub Form_Open ... > You could use any character to represent the YES/NO dots. ... > need to find a special font like WEBDINGS or WINGDINGS (use MS Word to ... > translate the True/False values to the special characters, ...
    (microsoft.public.access.gettingstarted)