I wany to record an IP address in access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 
Back
Top