TPetersonFlorida
Programmer
All i am trying to do is setup a btrieve api call to just get all the records in a btrieve file. i am getting an error when calling the BGETFIRST. i doing this in VB 6.0, please help. here is my code:
These are my UDTS:
Type RecordBuffer
Junk1 As String * 6
MilID As String * 10
MilNumber As String * 2
MilSymbol As String * 1
MilDesc As String * 40
MilWeight As String * 8
MilSchedDate As Long
MilForcastDate As Long
MilCompleteFlag As String * 1
MilPctComplete As String * 3
MilWBS As Long
Junk2 As String * 7
End Type
Type RecordBufferByte
Junk1 As String * 6
MilID As String * 10
MilNumber As String * 2
MilSymbol As String * 1
MilDesc As String * 40
MilWeight As String * 8
MilSchedDate As typLongArr
MilForcastDate As typLongArr
MilCompleteFlag As String * 1
MilPctComplete As String * 3
MilWBS As typLongArr
Junk2 As String * 7
End Type
Here is my function:
Function TestCalls()
Dim FileName As String, PosBlk As Variant, KeyBuffer As String, KeyBufLen As Integer
Dim KeyNum As Integer, Status As Integer, BufLen As Integer
Dim DataBufVB As RecordBuffer
Dim DataBufBT As RecordBufferByte
FileName = CurrentProject.Path & "\250cam2a.mil"
PosBlk = Space$(128)
KeyBuffer = Space$(KEY_BUF_LEN)
'Open File
KeyBufLen = KEY_BUF_LEN
KeyBuffer = FileName
BufLen = Len(DataBufBT)
KeyNum = 0
Status = BTRCALL(BOPEN, PosBlk, DataBufBT, BufLen, ByVal KeyBuffer, KeyBufLen, KeyNum)
If Status <> 0 Then Stop
BufLen = Len(DataBufBT)
KeyBuffer = Space$(255)
KeyBufLen = KEY_BUF_LEN
Status = BTRCALL(BGETFIRST, PosBlk, DataBufBT, BufLen, ByVal KeyBuffer, KeyBufLen, 0)
If Status <> 0 Then Stop
DataBufVB.Junk1 = DataBufBT.Junk1
DataBufVB.Junk2 = DataBufBT.Junk2
DataBufVB.MilCompleteFlag = DataBufBT.MilCompleteFlag
DataBufVB.MilDesc = DataBufBT.MilDesc
DataBufVB.MilID = DataBufBT.MilID
DataBufVB.MilNumber = DataBufBT.MilNumber
DataBufVB.MilPctComplete = DataBufBT.MilPctComplete
DataBufVB.MilSymbol = DataBufBT.MilSymbol
DataBufVB.MilWeight = DataBufBT.MilWeight
CopyMemory DataBufBT.MilForcastDate, ByVal DataBufVB.MilForcastDate, 4
CopyMemory DataBufBT.MilSchedDate, ByVal DataBufVB.MilSchedDate, 4
CopyMemory DataBufBT.MilWBS, ByVal DataBufVB.MilWBS, 4
Stop
End Function
These are my UDTS:
Type RecordBuffer
Junk1 As String * 6
MilID As String * 10
MilNumber As String * 2
MilSymbol As String * 1
MilDesc As String * 40
MilWeight As String * 8
MilSchedDate As Long
MilForcastDate As Long
MilCompleteFlag As String * 1
MilPctComplete As String * 3
MilWBS As Long
Junk2 As String * 7
End Type
Type RecordBufferByte
Junk1 As String * 6
MilID As String * 10
MilNumber As String * 2
MilSymbol As String * 1
MilDesc As String * 40
MilWeight As String * 8
MilSchedDate As typLongArr
MilForcastDate As typLongArr
MilCompleteFlag As String * 1
MilPctComplete As String * 3
MilWBS As typLongArr
Junk2 As String * 7
End Type
Here is my function:
Function TestCalls()
Dim FileName As String, PosBlk As Variant, KeyBuffer As String, KeyBufLen As Integer
Dim KeyNum As Integer, Status As Integer, BufLen As Integer
Dim DataBufVB As RecordBuffer
Dim DataBufBT As RecordBufferByte
FileName = CurrentProject.Path & "\250cam2a.mil"
PosBlk = Space$(128)
KeyBuffer = Space$(KEY_BUF_LEN)
'Open File
KeyBufLen = KEY_BUF_LEN
KeyBuffer = FileName
BufLen = Len(DataBufBT)
KeyNum = 0
Status = BTRCALL(BOPEN, PosBlk, DataBufBT, BufLen, ByVal KeyBuffer, KeyBufLen, KeyNum)
If Status <> 0 Then Stop
BufLen = Len(DataBufBT)
KeyBuffer = Space$(255)
KeyBufLen = KEY_BUF_LEN
Status = BTRCALL(BGETFIRST, PosBlk, DataBufBT, BufLen, ByVal KeyBuffer, KeyBufLen, 0)
If Status <> 0 Then Stop
DataBufVB.Junk1 = DataBufBT.Junk1
DataBufVB.Junk2 = DataBufBT.Junk2
DataBufVB.MilCompleteFlag = DataBufBT.MilCompleteFlag
DataBufVB.MilDesc = DataBufBT.MilDesc
DataBufVB.MilID = DataBufBT.MilID
DataBufVB.MilNumber = DataBufBT.MilNumber
DataBufVB.MilPctComplete = DataBufBT.MilPctComplete
DataBufVB.MilSymbol = DataBufBT.MilSymbol
DataBufVB.MilWeight = DataBufBT.MilWeight
CopyMemory DataBufBT.MilForcastDate, ByVal DataBufVB.MilForcastDate, 4
CopyMemory DataBufBT.MilSchedDate, ByVal DataBufVB.MilSchedDate, 4
CopyMemory DataBufBT.MilWBS, ByVal DataBufVB.MilWBS, 4
Stop
End Function