ms-access

Incompatible types using CDate() in Access VBA

僤鯓⒐⒋嵵緔 提交于 2020-01-07 03:57:29
问题 I'm calculating with dates in MS Access using VBA. This works fine when I have two dates on the same form (ex 2016-01-21) but not when I first need to modify a string into date form like this: 20160121 -> 2016-01-21. This is what I'm trying to do: Dim sYear As String, sMonth As String, sDay As String, sDate As String sYear = Left("20160121", 4) sMonth = Mid("20160121", 5, 2) sDay = Mid("20160121", 7, 2) sDate = sYear & "-" & sMonth & "-" & sDay MsgBox CDate(sDate) This returns Error 13,

Automatically generate numbers

China☆狼群 提交于 2020-01-07 03:57:21
问题 I am in need of a tracking number that automatically generates. I added this in the 'Before Insert' action (see below), but I am having a problem after the number 9. Me![Tracking#] = Nz(DMax("[Tracking#]", "[TblTrackingNum]"), 0) + 0.01 My tracking number always starts of with 89669. This code works until it reaches the number ten. The tracking number should do this: 89669.1... 89669.2... 89669.3... 89669.4... 89669.5..... But after 9 it changes the number to 89670. I need it to say 89669.10.

MS Access: Error from WHERE condition evaluated on query inside join

依然范特西╮ 提交于 2020-01-07 03:52:15
问题 When I paste the following query into SQL View in Access 2007: SELECT ID_Entry, DateVal FROM (SELECT [Query A].ID_Entry, DateVal FROM [Query A] INNER JOIN [Query B] ON [Query A].ID_Entry = [Query B].ID_Entry ) AS QueryAJoinB ORDER BY ID_Entry, DateVal; it returns a large recordset whose smallest value of ID_Entry is 19. I need to select records from that recordset based on the value of the field DateVal . ( ID_Entry is a table index. DateVal is calculated as CDate(CleanRegData(<arguments with

Inserting only SELECTED fields in combo box into a Temp Table

我的梦境 提交于 2020-01-07 03:40:09
问题 I've created a form that pulls in records and displays them in a List Box. I have a radio button for "all employees" where it selects them all and i can create a report but I also have a radio button for "select employees" so I can go in and select the few that I want to report on. The problem is when I select a few employees It still Loops through all of the records in the list box while inputting into the temp table. Is there a simple way to quickly Insert just the selected items into the

Make Fileds compulsory if a particular filed is filled in Access Form

巧了我就是萌 提交于 2020-01-07 03:24:14
问题 I have a form in access, where I want to make 3 fields ( FYear , cboPeriodicity , cboPeriod ) compulsory if another field cboCompliance is filled in by user. I have tried the below code, where I am canceling save, if any of these fields are Empty. And also giving error message through msgBox Private Sub Form_BeforeUpdate(Cancel As Integer) On Error GoTo Form_BeforeUpdate_Err 'Audit Data Values Set Me.LastModifiedBy.Value = [TempVars]![currentUserID] Me.LastModifiedTime.Value = Now() 'If

Pivoting a table with predefined headers [closed]

北战南征 提交于 2020-01-07 03:18:07
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago . ID | NAME | Description A A Value1 A A Value2 B B Value1 C C Value1 C C Value2 C C Value3 D D Value1 D D Value2 D D Value3 D D Value4 D D Value5 D D Value6 I have this input, and i am trying to convert it into this. ID | NAME | Desc1 | Desc2 | Desc3 | Desc4 | Desc5 | Desc6 A A Value1 Value2 B B

How to avoid prompting for user id and password in MSAccess 2003

纵饮孤独 提交于 2020-01-07 03:12:05
问题 I am a .Net / SQL Server programmer. I am trying to make an Access database created by someone else to work. It looks like is uses a procedure similar to Save password for ODBC connection to SQL Server from MS Access 2007 but I am using Access 2003 so I suspect something else needs to be done. I don't really know what I am doing with Access but I am stuck with it. I do have an ODBC connection and it looks like the linked tables use it. The database has an AutoExec which populates some local

Dealing with Split() function: how to adjust for either return/tab input

允我心安 提交于 2020-01-07 02:59:12
问题 I currently have a serial number inventory database I am working on. I was using the split() function with a space delimiter to separate the data into individual data points, however the scanner I use uses delimiters of either 'return' or 'tab' Is there any way to use either of those functions in the split() function?? I don't believe tab is possible because tab jumps to the 'next' button... so when the scanner inputs for example (data1 [tab] data2 [tab] data3 [tab]) into the textbox, my

Best way to close Access Jet OledbConnection

喜夏-厌秋 提交于 2020-01-07 02:32:09
问题 In my winform application - framework 3.5 sp1 - I have a custom Data-Reader. I have to choose the way to close the connection First way: Private cn As OleDb.OleDbConnection = Nothing Public Sub Open() cn = New OleDb.OleDbConnection(sConnectionString) cn.Open() ' ... End Sub Public Sub Close() ' ... cn.Close() cn.Dispose() End Sub Second way: Public Sub Open() Dim cn As New OleDb.OleDbConnection(sConnectionString) cn.Open() ' ... End Sub Public Sub Close() ' ... End Sub In the second way is

Copying Text using ClipBoard_SetData() doesn't work

随声附和 提交于 2020-01-07 02:24:09
问题 I'm calling a function to copy text to the Windows clipboard using the API function from http://support.microsoft.com/kb/210216 using Access 2003 on Windows XP. The function does clear the Clipboard, but it silently fails on the actual assignment to the clipboard. Stepping through the code and querying for errors in the immediate window yields nothing. I copied and pasted the MS function exactly as shown on their webpage. 回答1: I use this function, which does almost exactly the same thing. It