vb如何自动编号
是这样的,我们需要一个自动给图纸编号的程序,而且用过的编号就不能在使用了,比如说一把剪刀的零件图编号是JD59-1,那么下次在遇到另外一把剪刀的零件图时就是JD59-2,...
是这样的,我们需要一个自动给图纸编号的程序,而且用过的编号就不能在使用了,比如说一把剪刀的零件图编号是JD59-1,那么下次在遇到另外一把剪刀的零件图时就是JD59-2,之前用过的图号在以后编号中不能再使用。因为我没有学过VB,所以想请大家帮帮忙,毕竟金融危机下都不容易,我是今年毕业生,很珍惜这份工作,希望大家帮帮我!谢谢
展开
3个回答
展开全部
1 如果是oracle数据库 的话可以利用序列
2.如果是用vb程序产生,可以利用访问的时间生成。 Fun_GetLocalTime(1)可以返回你要的。
Private Const CB_SETCURSEL = &H14E
Private Type uSystemTime
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As uSystemTime)
'*********************************************************************************************
'名称 Fun_GetLocalTime
'作者 MornWoo20071016
'功能 获取系统的时间,精确到毫秒。
'参数 无
'返回 返回字符串数据: iFormat = 0,"YYYY-MM-DD HH:MM:SS"+" " + "毫秒数";iFormat=1,yyyymmddhhmmss毫秒数
' iFormat = 2,"YYYY-MM-DD HH:MM:SS"
'*********************************************************************************************
Function Fun_GetLocalTime(Optional ByVal iFormat = 0) As String
Dim uSysTime As uSystemTime
Dim sA
GetSystemTime uSysTime
If CInt(uSysTime.wHour + 8) < 24 Then
Select Case iFormat
Case 0
sA = Format(CStr(uSysTime.wYear) & "-" & CStr(uSysTime.wMonth) & "-" & CStr(uSysTime.wDay), "yyyy-mm-dd") & _
" " & Format(CStr(uSysTime.wHour + 8), "00") & ":" & Format(CStr(uSysTime.wMinute), "00") & ":" & _
Format(CStr(uSysTime.wSecond), "00") & "." & CStr(uSysTime.wMilliseconds)
Case 1
sA = Format(CStr(uSysTime.wYear) & "-" & CStr(uSysTime.wMonth) & "-" & CStr(uSysTime.wDay), "yyyymmdd") & _
Format(CStr(uSysTime.wHour + 8), "00") & Format(CStr(uSysTime.wMinute), "00") & _
Format(CStr(uSysTime.wSecond), "00") & CStr(uSysTime.wMilliseconds)
Case 2
sA = Format(CStr(uSysTime.wYear) & "-" & CStr(uSysTime.wMonth) & "-" & CStr(uSysTime.wDay), "yyyy-mm-dd") & _
" " & Format(CStr(uSysTime.wHour + 8), "00") & ":" & Format(CStr(uSysTime.wMinute), "00") & ":" & _
Format(CStr(uSysTime.wSecond), "00")
End Select
Else
Select Case iFormat
Case 0
sA = Format(CStr(uSysTime.wYear) & "-" & CStr(uSysTime.wMonth) & "-" & CStr(uSysTime.wDay), "yyyy-mm-dd") & _
" " & Format(CStr(uSysTime.wMinute), "00") & _
":" & Format(CStr(uSysTime.wSecond), "00") & "." & CStr(uSysTime.wMilliseconds)
Case 1
sA = Format(CStr(uSysTime.wYear) & "-" & CStr(uSysTime.wMonth) & "-" & CStr(uSysTime.wDay), "yyyymmdd") & _
Format(CStr(uSysTime.wMinute), "00") & _
Format(CStr(uSysTime.wSecond), "00") & CStr(uSysTime.wMilliseconds)
Case 2
sA = Format(CStr(uSysTime.wYear) & "-" & CStr(uSysTime.wMonth) & "-" & CStr(uSysTime.wDay), "yyyy-mm-dd") & _
" " & Format(CStr(uSysTime.wMinute), "00") & _
":" & Format(CStr(uSysTime.wSecond), "00")
End Select
End If
Fun_GetLocalTime = sA
End Function
2.如果是用vb程序产生,可以利用访问的时间生成。 Fun_GetLocalTime(1)可以返回你要的。
Private Const CB_SETCURSEL = &H14E
Private Type uSystemTime
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As uSystemTime)
'*********************************************************************************************
'名称 Fun_GetLocalTime
'作者 MornWoo20071016
'功能 获取系统的时间,精确到毫秒。
'参数 无
'返回 返回字符串数据: iFormat = 0,"YYYY-MM-DD HH:MM:SS"+" " + "毫秒数";iFormat=1,yyyymmddhhmmss毫秒数
' iFormat = 2,"YYYY-MM-DD HH:MM:SS"
'*********************************************************************************************
Function Fun_GetLocalTime(Optional ByVal iFormat = 0) As String
Dim uSysTime As uSystemTime
Dim sA
GetSystemTime uSysTime
If CInt(uSysTime.wHour + 8) < 24 Then
Select Case iFormat
Case 0
sA = Format(CStr(uSysTime.wYear) & "-" & CStr(uSysTime.wMonth) & "-" & CStr(uSysTime.wDay), "yyyy-mm-dd") & _
" " & Format(CStr(uSysTime.wHour + 8), "00") & ":" & Format(CStr(uSysTime.wMinute), "00") & ":" & _
Format(CStr(uSysTime.wSecond), "00") & "." & CStr(uSysTime.wMilliseconds)
Case 1
sA = Format(CStr(uSysTime.wYear) & "-" & CStr(uSysTime.wMonth) & "-" & CStr(uSysTime.wDay), "yyyymmdd") & _
Format(CStr(uSysTime.wHour + 8), "00") & Format(CStr(uSysTime.wMinute), "00") & _
Format(CStr(uSysTime.wSecond), "00") & CStr(uSysTime.wMilliseconds)
Case 2
sA = Format(CStr(uSysTime.wYear) & "-" & CStr(uSysTime.wMonth) & "-" & CStr(uSysTime.wDay), "yyyy-mm-dd") & _
" " & Format(CStr(uSysTime.wHour + 8), "00") & ":" & Format(CStr(uSysTime.wMinute), "00") & ":" & _
Format(CStr(uSysTime.wSecond), "00")
End Select
Else
Select Case iFormat
Case 0
sA = Format(CStr(uSysTime.wYear) & "-" & CStr(uSysTime.wMonth) & "-" & CStr(uSysTime.wDay), "yyyy-mm-dd") & _
" " & Format(CStr(uSysTime.wMinute), "00") & _
":" & Format(CStr(uSysTime.wSecond), "00") & "." & CStr(uSysTime.wMilliseconds)
Case 1
sA = Format(CStr(uSysTime.wYear) & "-" & CStr(uSysTime.wMonth) & "-" & CStr(uSysTime.wDay), "yyyymmdd") & _
Format(CStr(uSysTime.wMinute), "00") & _
Format(CStr(uSysTime.wSecond), "00") & CStr(uSysTime.wMilliseconds)
Case 2
sA = Format(CStr(uSysTime.wYear) & "-" & CStr(uSysTime.wMonth) & "-" & CStr(uSysTime.wDay), "yyyy-mm-dd") & _
" " & Format(CStr(uSysTime.wMinute), "00") & _
":" & Format(CStr(uSysTime.wSecond), "00")
End Select
End If
Fun_GetLocalTime = sA
End Function
展开全部
不知道是不是所有的零件图的编号都是统一的
如果是直接把编号JD59-1 把1 用1+1 就可以了 把JD59-1 这个1申明个变量表示 记录数值
“JD59”-变量
如果是直接把编号JD59-1 把1 用1+1 就可以了 把JD59-1 这个1申明个变量表示 记录数值
“JD59”-变量
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
题目说明不清楚
数据是哪来的, JD59是怎么确定的,等等
是数据库还是在Acad里面。
数据是哪来的, JD59是怎么确定的,等等
是数据库还是在Acad里面。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询